Treasury Secretary John Fraser is quitting, to be replaced by Scott Morrison's former chief of staff.

Australia's chief economic bureaucrat will leave his role on July 31, over three years since he was appointed by then-prime minister Tony Abbott.

“In the last three-and-a-half years in the role as Treasury Secretary Mr Fraser has led Treasury to new heights, especially in the areas of corporate and personal income tax reform,” Prime Minister Malcolm Turnbull said.

“He has strongly supported the Government's efforts to help repair the budget.

“He has been a trusted adviser to the Treasurer, ministers and myself on key economic matters.

“On behalf of the Government, I thank him for his service to the Australian community and our economy.”

Mr Turnbull is having Mr Fraser replaced by Philip Gaetjens - who recently departed as the chief of staff to Treasurer Scott Morrison.

Mr Gaetjens was secretary of the New South Wales Treasury from 2011 and 2015, as well as serving as a senior executive in the Commonwealth Treasury, the Department of Prime Minister and Cabinet and the South Australian Department of Treasury and Finance.

The Opposition has accused the Government of politicising the Treasury.

“Despite this appointment coming on the eve of a general election — when Treasury [with Finance] produces the pre-election economic and fiscal outlook — the Treasurer did not bother to consult with the Opposition,” Shadow Treasurer Chris Bowen said in a statement.

“The Treasury is a fine institution that deserves the best people and processes and not the constant politicisation that Scott Morrison has subjected it to.”