China’s factory activity improved marginally in August, according to official data released Monday, as strong export demand helped lift production and new orders. However, the overall manufacturing sector remained in contraction territory, with the official purchasing managers’ index (PMI) at 8 in August, up from 2 in July, as reported by the National Bureau of Statistics (NBS).

The reading was better than economists had expected, according to multiple reports. PMI readings are based on monthly surveys of companies and are measured on a scale of 0 to 100, with a reading above 50 indicating expansion and below 50 reflecting contraction.

Several sub-indices returned to expansion in August. The production sub-index advanced to 4 from 9 in July, the new orders sub-index recovered to 6 from 5, and the new export orders sub-index improved to 1 from 6, according to NBS data.

Huo Lihui, a chief statistician with the NBS, said in a statement that the August PMI data reflected an improvement in China’s overall economy. He also said that “the overall business climate in manufacturing improved visibly in August, with 16 out of 21 surveyed industries registering month-on-month gains,” and noted that “both production and demand expanded in tandem,” anchored by solid gains in hi-tech manufacturing and large firms.

Lynn Song, chief economist for Greater China at ING, said the data came in a little stronger than market expectations, adding this could set the stage for a slight recovery in the industrial production growth data for August, scheduled for release in a few weeks.

Nguyen Hoang Nam, a China economist at Capital Economics, wrote in a research note Monday that “manufacturing activity rebounded thanks to strong export demand.”

The strength in exports was a key factor behind the improvement. Chinese exports jumped almost 24% in July from a year earlier and increased more than 18% in the first seven months of the year, according to NBS data. Export growth was supported by strong demand for high-tech goods such as semiconductors, linked to the boom in artificial intelligence, as well as robust demand for electric vehicles, partly fueled by higher energy costs due to the Iran war.

China has also been exporting more to regions including Europe and Southeast Asia, as S. tariffs have dented S. trade following President Donald Trump’s return to the White House last year.

Max Zenglein, a senior economist for Asia Pacific at The Conference Board, said: “Demand for green technologies was already accelerating last year and has continued to strengthen, providing an important additional boost to Chinese exports so far this year.”

Despite the boom in trade, sluggish domestic demand, partly due to a protracted slump in the property sector, has weighed on the Chinese economy. The economy grew at an annual pace of 3% in the April-June quarter, the slowest growth rate recorded in more than three years.

Trade issues are expected to remain a key issue in discussions between Trump and Chinese leader Xi Jinping, who are expected to meet in late September.