Beijing (AFP) - An official measure of manufacturing activity in China rebounded to its strongest level in nearly two years last month on improving production and demand, the government said Thursday, boding well for the world's second-largest economy.

The official purchasing managers' index (PMI) came in at 50.4 for August, its highest since October 2014, figures from the National Bureau of Statistics (NBS) showed.

It rose from July's 49.9 and was well ahead of the median forecast of 49.8 in a Bloomberg News survey of economists.

A figure above 50 signals expanding activity, while anything below demonstrates shrinkage. Investors closely watch the PMI readings, which gauge conditions at Chinese factories and mines, as the first indicator of the health of the economy each month.

August's PMI "featured rebounding production and demand and a further optimised structure", NBS analyst Zhao Qinghe said in a statement.

The key manufacturing sector has been struggling for months in the face of sagging global demand for Chinese products and excess industrial capacity left over from the country's infrastructure boom.

Zhao also noted that downward pressures remain on imports and exports due to sluggish recovery in global growth.

Around 40 percent of the companies surveyed complained they were cash-strapped, and more firms were facing rising labour and logistics costs, Zhao pointed out.

China is a vital driver of global growth, but its economy expanded only 6.9 percent in 2015 -- its weakest rate in a quarter of a century -- and has slowed further this year.

Beijing has said it wants to reorient the economy away from relying on debt-fuelled investment to boost growth and towards a consumer-driven model, but the transition has proven challenging.

Figures provided by NBS' Zhao showed that small- and medium-sized companies were having a harder time than large firms, which generally have better access to loans and the market, with the PMI for smaller manufacturers contracting and that for bigger ones expanding.

Story continues

The private Caixin Purchasing Managers' Index, which focuses on small companies, pointed to a similar trend.

Its reading fell to the no-change mark of 50.0 in August from 50.6 the previous month, the Chinese financial magazine said in a joint statement Thursday with data compiler IHS Markit.

"The stagnation that follows tentative signs of recovery in July may have been caused by a temporary tightening of proactive fiscal policies," Caixin analyst Zhong Zhengsheng said in the statement.

"Downward pressure on China’s economy remains and government support to stabilise growth must continue."

The official PMI reading for the service sector was 53.5 for August, down from 53.9 in July, according to the NBS.