The economy has come through the initial impact of the Covid-19 pandemic in better shape than expected but faces a tougher and longer road to full recovery, according to the Treasury.

The pre-election opening of the government books (PREFU) showed a budget deficit of $23.4 billion for the year ended June, while the level of debt is marginally better at 27.6 percent of gross domestic product (GDP).

"These are signs that the New Zealand economy is robust, and that our plan to eliminate Covid-19 and open the economy faster is the right approach," Finance Minister Grant Robertson said.

The shorter lockdowns and strong rebound in activity have helped to support government finances with the tax take moderately lower on a year ago, while the initial measures to support households and businesses caused government spending to surge to $108.8 billion.

Robertson said government spending had cushioned the blow of a one-in-100 year shock, which would need to be maintained for the near and medium term.

"There will be tough times ahead for many in our country," Robertson told a PREFU media briefing.

But he warned that the current better than expected economic and fiscal situation, would get tougher and take longer than had been forecast in the May budget.

The Treasury has forecast the economy will average annual growth of 2.8 percent over the next four years from a budget forecast of 3.9 percent, but it has trimmed its unemployment forecast to peak at 7.7 percent next year after which it gradually declines over the next four years to 5.3 percent.

That is based on an assumption that borders will remain closed until 2022, and that world growth will be lower and slower because of resurgence of the virus around the world.

Consequently government spending and borrowing will remain elevated for sometime.

Net debt is now forecast to peak at 55.3 percent of GDP in 2024, marginally higher than in the budget, while budget deficits peak next year at $31.7bn, before reducing to $12.4bn in 2024.

"The borrowing is necessary... but it comes at a cost," Robertson said.

He said the government had $14.1bn uncommitted to be spent on future measures if there should be a significant return of Covid-19 to the country.

"We can afford the debt without cutting key core services... we will manage the books responsibly... we will keep a balance."