HONG KONG — Consumer prices rose less than expected last month in China as the unappetizing and widely televised spectacle of thousands of dead pigs floating upstream from Shanghai helped push pork prices down sharply, the government reported on Tuesday.

The National Bureau of Statistics announced that consumer prices were 2.1 percent higher in March than a year ago. Prices had been 3.2 percent higher in February.

Pork is a staple of the Chinese diet and its price has long been such a significant component of the country’s consumer price index that it can influence overall inflation. Pork prices tumbled 5.5 percent last month from a year earlier, the National Bureau of Statistics said.

Factories and other producers also faced falling prices last month. Producer prices in China were down 1.9 percent in March, compared with a year-over-year decline of 1.6 percent in February.