WASHINGTON — U.S. wholesale prices shot up an unexpected 0.6% in July, biggest gain since October 2018, as energy prices moved sharply higher.

The Labor Department said Tuesday that the jump last month in its producer price index — which measures inflation before it reaches consumers — followed a 0.2% drop in June and a 0.4% uptick in May. The increase last month was about twice what economists had expected.

Wholesale energy prices shot up 5.3% in July, including a 10.1% surge in gasoline prices. Food prices slid 0.5%. Excluding the volatile food and energy prices, so-called core producer prices rose 0.5% last month.

Over the past year, producer prices are down 0.4%, and core prices are up 0.3%. Inflation has been held in check by the sharp recession caused by the coronavirus outbreak and the resulting lockdowns and fear that have kept Americans away from restaurants, airplanes and shopping centers. Producer prices for airline services plummeted 7% last month.

"Core inflation readings will likely remain muted over coming months in response to ongoing weak demand and ample excess capacity,'' Rubeela Farooqi, chief U.S. economist at High Frequency Economics, wrote in a research report.