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...