BEIJING—China’s producer prices fell into deflation for the first time in three years, as worries over the trade war with the U.S. sapped demand, adding another complication to Beijing’s efforts to shore up its slowing economy.

Factory-gate prices are seen by economists and investors as a bellwether of industrial demand in China. As trade tensions with the U.S. escalate, global demand for Chinese goods is expected to erode, further weighing on prices of industrial goods.

While producer prices fell 0.3% from a year earlier in July—lower than economists’ median forecast for a 0.1% drop—consumer prices edged up to a 17-month high, squeezing households’ spending power.

The data present a potential dilemma for China’s central bank. It could loosen monetary policy in a bid to stimulate demand and lift producer prices out of deflation, but a massive stimulus program would risk pushing consumer inflation higher and causing the property market to overheat, economists say.

“I think the central bank will put more weight on weaker producer prices, which gives them a foundation of more easing that is also needed to counter impacts of trade fight and a cooling growth momentum at home,” said Lin Shu, an analyst with China Merchants Securities.