By Rob Taylor and James Glynn

CANBERRA, Australia--Australia's government forecast wider budget deficits and slower growth over the coming years, although it stuck to a pledge to deliver a surplus in the next five years, helping to stave off an immediate ratings downgrade.

The resource-rich economy has been suffering from a slowdown in China, weak commodity prices and falling mining investment at the end of a long commodities boom. A planned shift in investment focus to non-mining industries--such as services--appears to have stalled. Tax revenues have fallen, forcing the government to seek savings.

The ruling center-right coalition on Monday forecast a deterioration in the budget of 10.3 billion Australian dollars(US$7.5 billion) over the next four years. The deficit in the year starting July 1, 2017 is now forecast at A$28.7 billion, up from A$26.1 billion in May. Treasurer Scott Morrison also lowered growth forecasts for the current fiscal year to 2.0% from 2.5%.

Still, the government said it remains on track to restore the budget to surplus by fiscal 2020-21.

Global credit ratings firms warned ahead of Monday's midyear budget update that the country risked a downgrade of its prized triple-A sovereign debt rating--to AA+--if it didn't show a clear path back to surplus. Australia hasn't been downgraded since 1986.

Australia is one of only a handful of AAA-rated sovereigns remaining world-wide. A downgrade would raise borrowing costs for federal and state governments and the nation's commercial banks--which get around a third of their capital from overseas. It would also add pressure on Australian households, which are among the most indebted in the world.

Standard & Poor's Global Ratings put Australia on credit watch after cliffhanger elections in July that left Prime Minister Malcolm Turnbull's conservatives with a narrow majority, making it difficult to pass budget reforms.

S&P said Monday that the government's worsening forecasts "further pressures the rating," adding that it is pessimistic about the government's ability to return to surplus within the promised time frame.

"Over the coming months, we will continue to monitor the government's willingness and ability to enact new budget savings or revenue measures to reduce fiscal deficits materially over the next few years," it said in a statement.

Fitch Ratings and Moody's Investors Service affirmed their triple-A ratings, but said that passing further budget savings through Parliament was a challenge.

Mr. Morrison has pledged cuts to generous welfare and social programs over the next four years. But savings measures worth A$14 billion remain blocked in the Senate, where the government needs support from fringe lawmakers to pass legislation.

Some analysts said it was likely only a matter of time before Australia loses its triple-A rating.

"While today's fiscal update still projects a return to surplus in 2020/21...the ongoing deterioration in the starting point for consolidation will mean that the hurdle to keep the AAA credit rating is higher," J.P. Morgan analysts said Monday. "This is an unenviable proposition given the current composition of the Parliament."

Mr. Turnbull, a wealthy former Goldman Sachs banker, promised voters economic improvement after ousting Tony Abbott as conservative prime minister last year. Instead, Australia's economy contracted for the first time since early 2011 in the third quarter, threatening the longest ongoing recession-free streak in the developed world. Unemployment has crept upto 5.7%.

Since he became leader, the global economic outlook has become more complicated, with the shock of Britain's decision to leave the European Union and a likely more-protectionist U.S. administration in 2017 both posing risks to Australia's trade-reliant economy. U.S. President-elect Donald Trump has threatened a trade war with China, Australia's biggest export customer.

The government on Monday said it expected net debt would peak at 19% of GDP in fiscal 2018-19, a year later than previously expected.

Unemployment is expected to hover at 5.5% at the end of the fiscal year, unchanged from a May forecast of 5.5%. Treasury officials now expect growth to reach 2.75% in fiscal 2017-18 and 3% the year after that.

The budget update forecast iron-ore prices would decline from recent averages of around US$68 a metric ton to around US$55 a metric ton by September 2017--much lower than boom-era highs of about US$190.

Write to Rob Taylor at rob.taylor@wsj.com and James Glynn at james.glynn@wsj.com

(END) Dow Jones Newswires

December 19, 2016 00:28 ET (05:28 GMT)

Copyright (c) 2016 Dow Jones & Company, Inc.