Germany’s producer prices rose strongly in April, driven by higher energy prices, posting the biggest increase ever recorded, the German statistics office Destatis said.

Producer prices rose 33.5% on year, Destatis said.

Energy prices rose 87.3% from a year earlier, it said. Strong gains in the price of natural gas, up 154.8% on year, were a major factor behind the increase, it said.

The producer price index excluding energy rose 16.3% on year, according to Destatis.

Prices of intermediate goods increased 26.0% from a year earlier. Significant price increases were recorded by metals, fertilizers, prepared feeds for farm animals and wooden containers, Destatis said.

Prices of nondurable consumer goods increased by 13.2% on year, prices of durable consumer goods rose 8.3% and capital-goods prices increased by 6.7%, Destatis’s data showed.

Write to Maria Martinez at maria.martinez@wsj.com