BERLIN, May 20 (Reuters) - German producer prices saw their highest-ever annual rise in April as the Ukraine war sends the cost of energy spiralling for industry in Europe's largest economy, according to data released on Friday.

Producer prices of industrial products surged by 33.5% on the same month last year, the Federal Statistical Office reported. Compared to March 2022, prices rose 2.8%, it added.

Energy prices as a whole were up 87.3% compared to April 2021, the office said, attributing this mainly to strong price increases of natural gas, which was up 154.8% on the same period last year.

Power plants had to pay four times as much as a year before, and electricity prices rose by 87.7% year on year, the data showed, as Germany counts the mounting costs of pivoting away from Russian fossil fuel imports in the wake of Moscow's invasion of Ukraine.

Especially high price increases were recorded for fertilisers and nitrogen compounds whose prices more than doubled, increasing by 111.7 %, the federal agency said, illustrating the impact of the conflict on agriculture and global food supplies.

In April, the second full month of the war, food prices in Germany spiked by 17.3% year on year, according to the data. (Reporting by Rachel More Editing by Riham Alkousaa, Miranda Murray and Tomasz Janowski)