China's consumer prices rose slightly less than expected in April, while a four-year slump in producer prices continued to show signs of moderating, easing strains on companies facing sluggish demand and high debt levels.

The consumer price index rose 2.3 percent in April from a year ago, unchanged from March, though prices fell 0.2 percent month-on-month, the National Bureau of Statistics said on Tuesday.

Inflation appeared to be driven largely by higher food prices, rather than an improvement in broader economic activity which many global investors had been hoping for.

The price of pork jumped 33.5 percent, accelerating from a 28.4 percent surge in March. The Beijing municipal government said last week it will release 3 million kilograms of frozen pork reserves in a bid to combat prices.

Food prices actually fell 1.4 percent on a monthly basis, indicating a recent uptick in inflation could be short lived as food price moderate and the prices of other goods and services remain muted.

Analysts polled by Reuters had predicted the consumer price index (CPI) would rise 2.4 percent in April, compared with 2.3 percent the prior month.

Producer prices in April fell 3.4 percent from a year earlier, compared with the previous month's fall of 4.3 percent.

The market had expected producer prices to fall 3.8 percent on an annual basis.

China's factory prices have been falling for over 4 years, through April's decline was the smallest since prices fell 3.3 percent in December 2014.

Prices of steel and other industrial commodities have risen since the beginning of the year on the back of record credit expansion, but sharp declines in commodities futures prices over the last week indicate higher prices may not be sustainable.

Analysts say demand remains weak and overcapacity issues have not been resolved.

The soft April inflation data, weaker-than-expected exports and imports and softer factory survey results have raised doubts about whether a strong pick-up in March activity was just a blip.

The economy grew at the slowest pace since 2009 in the first quarter of this year, and a government think-tank on Monday predicted growth would be flat in the second quarter at 6.7 percent.