BEIJING, July 15 (Reuters) - China's pork output in the second quarter shrank from a year earlier, government data showed on Monday, falling on an annual basis for a second consecutive quarter as weak demand amid a slowing economy limited slaughter rates.

Pork output for the March-May period fell 3% from a year ago to 13.98 million metric tons, a Reuters calculation based on data from the National Bureau of Statistics (NBS) showed on Monday.

This follows an annual decline of 0.4% in first-quarter 2024 pork output. The second quarter drop marks the first consecutive quarterly declines on an annual basis in output since 2020, also in the first and second quarters of that year.

There were 363.95 million hogs slaughtered during the first six months of 2024, down 3.1% from a year ago, NBS data showed.

China consumes about half of the world's pork.

The second quarter is normally the period with the lowest pork production as it follows a surge in slaughter for China's Lunar New Year holidays in January and February.

Improving hogs prices have encouraged some breeders to keep the hogs for fattening, which also contributed to a smaller slaughter, but analysts said consumption of meat continues to remain weak.

China's pig herd fell to 415.33 million head in the second quarter from 408.5 million heads in the previous quarter, the data showed.

Breeders are complying with Beijing's guidance to reduce hog numbers, after an aggressive expansion in recent years led to a glut that hammered pork prices.

The sow herd fell to 39.96 million heads at the end of May, down 6.2% from a year earlier, according to data from the Ministry of Agriculture and Rural Affairs.

That has supported a recovery in hog prices.

Cash prices in the world's biggest pork-producing nation were above 18 yuan ($2.48) per kg last week, compared to the below cost price of less than 14 yuan at the same time last year, according to data from consultancy MySteel. ($1 = 7.2599 Chinese yuan renminbi) (Reporting by Mei Mei Chu; Editing by Tom Hogue and Christian Schmollinger)