Taiwan’s exports nearly averted contraction in October, holding up much better than expected as the trade-dependent economy attempts to weather an intensifying global slowdown and dropping demand from China. 

Overseas shipments dropped 0.5% in October from a year earlier, the Ministry of Finance reported Tuesday. While still the second consecutive month of declines, it was far better than the 6% contraction forecast in a Bloomberg survey of economists. It was also an improvement from September’s 5.3% decrease.

Imports surprised with an 8.2% gain from a year prior, far surpassing expectations of a 5% drop. The trade surplus was nearly $3 billion, compared to $5 billion last month. 

Worsening global consumer demand led to the year-on-year decline in exports, though orders for new smartphone products helped offset that slump, the Ministry of Finance said in a statement.

The figures are a welcome sign for Taiwan, where officials have been warning for weeks that trade would be under pressure from global headwinds, including inflation, tighter monetary policy and cooling Chinese demand. The outlook around the region has worsened, with South Korea recently reporting dismal trade figures because of the drop-off in global demand.

Exports to Hong Kong and China -- significant markets for Taiwan -- were still weak in October, falling 9.2%. But that was better than September’s 13.3% decline. China, the world’s second-largest economy, reported Monday that both exports and imports fell last month for the first time in more than two years.

Exports to other markets offset suppressed demand from China. Shipments to the US increased 3.1% year-on-year, while shipments to Japan jumped 18.7% and those to Singapore rose 30.2%.

Still, Taiwan likely won’t be able to keep holding off steep declines: November exports are expected to fall between 5% and 8%, said Beatrice Tsai, the finance ministry’s chief statistician, at a Tuesday press briefing.

The ministry expects exports to either decline or grow at the year’s slowest pace in the fourth quarter. But Tsai said Taiwan still sees full-year exports reaching a record high.

“The strong exports performance from the beginning of the year offsets the weakness” this quarter, she said.

Domestic demand, meanwhile, has held up in Taiwan, supporting the economy at a time when exports are still sluggish. The economy managed to stave off a significant downturn in the third quarter, with officials pointing to local demand as a factor.