CHARTERS TOWERS, Australia – A gold rush in the late 19th century so enriched Charters Towers, an outback town in the state of Queensland, that it opened its own stock exchange. Trading ceased long ago, but the grand building still stands.

More than a century later, Queensland is reeling from the demise of another mining boom. "There was a perception it would go on forever," said Mayor Liz Schmidt.

Unlike so many other booms, this one has not ended in a national bust. Australia's economy is still standing.

Australia's resilience is remarkable. At its height, mining investment accounted for 9 percent of GDP. As the economy scrambled to meet China's demand for iron ore and coal, Australia's terms of trade spiked. The price of its exports, relative to its imports, reached the highest level since the gold rushes of the 1850s, said Philip Lowe, governor of the Reserve Bank of Australia, the central bank.

Like those 19th-century scrambles, the China "rush" brought sudden prosperity to far-flung places. Townsville, in north Queensland, hosted thousands of fly-in-fly-out workers (or "fifos"), who served the Bowen Basin's coal mines and Mount Isa's copper and zinc mines. Their six-figure salaries boosted the economy and inflated the housing market, which attracted speculative investors from Sydney, Melbourne and Brisbane. "There was so much money around," said Peter Wheeler, a Townsville estate agent.

Similar booms elsewhere have ended in horrible busts. The turn in the commodity cycle helped condemn Brazil and Russia to brutal recessions. In China, a sharp downturn in mining and metals prompted fears of a hard landing that still linger. Many argue that economic rebalancing and steady economic growth are incompatible goals.

That worry also gnawed at Australia. As commodity prices started falling, mining companies stopped investing in big projects. Townsville's house prices fell and its unemployment rate rose above 11 percent, almost double the national figure.

South of Townsville, around Gladstone, about 30,000 workers once had jobs building the state's liquefied natural gas (LNG) industry; last year, the industry employed just 5,000. These local difficulties could have added up to a national danger. When Australia's economy registered a negative growth rate in the third quarter of 2016, some feared the worst: Australia might at last fall into recession (commonly defined as two consecutive quarters of negative growth), a fate it had avoided for 25 years.

But the wobble quickly passed. In the fourth quarter, the economy regained momentum, growing by 2.4 percent compared with a year earlier. Australia's GDP is now almost as big as Russia's (if the two are compared at market exchange rates) and the Reserve Bank forecasts growth of about 3 percent this year and next. "We show that openness can deliver both prosperity and resilience," Lowe said.

As the mining boom petered out, the Reserve Bank cut its benchmark "cash" rate from 4.75 percent in 2011 to 1.5 percent. The Australian dollar fell steeply (it is now worth 76 U.S. cents, compared with a peak of $1.10 six years ago). The cheaper currency and lower interest rates have allowed the older and more populous states of New South Wales and Victoria to keep the economy bustling. Property developers are building more houses, farmers are exporting more food, and foreigners are paying more visits: Australia welcomed 1.2 million Chinese last year, a record.

Just as Australia's extractive industries benefited from China's appetites, its property market has benefited from China's anxieties: Australian homes are a popular investment for wealthy Chinese eager to move money somewhere safer.

Thanks in part to this capacity for reinvention, Australia's economic record remains remarkably unblemished.