The NSW government has been accused of working in "partnership" with mining giant Rio Tinto to circumvent court rejections of a coalmining expansion project in the Hunter Valley.

Documents obtained under freedom of information laws reveal how the miner pressed the government to change legislation to overturn court decisions that blocked the expansion of its Mount Thorley Warkworth Mine near Singleton.

Rio Tinto's Warkworth mine in the Hunter Valley. Credit:Dean Osland

In a letter to Barry O'Farrell dated May 13, 2013, Rio's chief executive for energy, Harry Kenyon-Slaney, said the company had held "several discussions" with the Department of Planning and Infrastructure since meeting the then premier 11 days earlier to develop options for reviving the expansion application.

"In our opinion, the only option left to secure an outcome that will deliver certainty to [the mine] ... is to legislate to validate the decision" of the Planning Assessment Commission approving the expansion, the letter noted.