BEIJING--China's consumer inflation beat market expectations in August thanks to a surge in pork prices, official data showed Tuesday.

The consumer price index rose 2.8% in August from a year earlier, matching the level in July, data from the National Bureau of Statistics showed.

The rise in the key inflation gauge exceeded the median 2.6% gain forecast by 14 economists in a poll by the Wall Street Journal.

China's pork prices surged 46.7% last month from a year earlier due to a shortage in pork supply, accelerating from July's 27% gain, official data showed. August's tally, the strongest monthly growth since mid-2008, lifted the headline consumer inflation by more than 1 percentage point in August.

Overall meat prices, including pork, beef and mutton surged nearly 31% in August, compared with July's 18.2% increase, as more consumers shifted to other meat items for protein.

Following are price-growth rates for subindexes: Subindex August July YoY% YoY% Food 10.0% 9.1% Fresh vegetables -0.8% 5.2% Fruit 24.0% 39.1% Pork 46.7% 27.0% Nonfood 1.1% 1.3%

The CPI increased 0.7% in August from July. In July, it rose 0.4% from the preceding month.

The government aims to keep consumer inflation under about 3% in 2019.

China's producer-price index fell 0.8% in August from a year earlier, the statistics bureau said. In July, PPI fell 0.3% on year.

The drop was slightly smaller than a 0.9% decline expected by economists.

-Grace Zhu and Liyan Qi