A vendor packages seafood for a customer at a stall in Qingdao in China's eastern Shandong province on October 16, 2018.

China's April consumer inflation was in line with expectations, but a spike in pork prices contributed to higher food prices, the National Bureau of Statistics data showed on Thursday.

Overall consumer price index (CPI) in April rose 2.5% from a year ago, meeting analysts' expectations and slightly higher that the 2.3% year-on-year in March.

However, food consumer price inflation rose 6.1% from a year ago in April compared to a 4.1% rise a month earlier, data from the bureau showed. Pork prices, in particular, soared 14.4% on-year and 1.6% on-month. China's hog herd has been hit by African swine fever in recent months.

April non-food inflation was 1.7 percent.

Producer price inflation (PPI) — a gauge of industrial profitability — rose 0.9% from a year ago in April, the fastest pace since December 2018. That was up from a 0.4% year-on-year increase in March, and higher than the 0.6% increase economists polled by Reuters expected.

Although both CPI and PPI picked up in April, "this shouldn't be interpreted as evidence of stronger domestic demand" as the inflation was driven mainly by supply-side disruptions, said Julian Evans-Pritchard, senior China economist at Capital Economics.

"With economic growth unlikely to stage a strong recovery and industrial commodity prices likely to drop back before long, we don't anticipate much upside to PPI and non-food CPI," Evans-Pritchard wrote in a note on Thursday.

The latest set of economic data came amid heightened tensions in the U.S.-China trade conflict.

At a rally on Wednesday night, U.S. President Donald Trump said Beijing "broke the deal" in the ongoing U.S.-China trade talks.

"By the way, you see the tariffs we're doing? Because they broke the deal. They broke the deal," Trump said. "They broke the deal. They can't do that, so they'll be paying."

Trump surprised markets over the weekend when he threatened in a Twitter post that he would significantly raise American levies on Chinese goods — with a first increase this coming Friday, and another "shortly."

The president said trade talks with China had been moving "too slowly." That came as a shock to many observers since recent reports had indicated the world's two largest economies could be set to sign an agreement as early as this week.

China, for its part, said earlier Wednesday that Beijing will retaliate if U.S. tariffs on $200 billion of Chinese goods are hiked to 25% from 10% as Trump had threatened.

— CNBC's Everett Rosenfeld and Reuters contributed to this report.