BERLIN - German inflation edged up unexpectedly in July, driven by an energy supply crisis as a further reduction in gas flows from Russia prompted concerns about even higher energy bills.

Consumer prices, harmonised to make them comparable with inflation data from other European Union countries (HICP), increased by 8.5% on the year, the federal statistics office said on Thursday, citing preliminary data.

"The increase in HICP inflation is a warning sign for the European Central Bank," ING economist Carsten Brzeski. The ECB uses this figure to measure consumer price inflation.

A first reading of July inflation for the wider euro zone is due on Friday. Consumer price growth in the 19 countries sharing the euro was a record-high 8.6% year-on-year in June, driven by rising energy and food prices.

A Reuters poll of analysts had forecast an annual HICP reading in Germany of 8.1% in July, up from 8.2% in June.

In non-harmonised terms, Germany's year-on-year consumer price index fell slightly in July to 7.5% from June's 7.6%.

"German headline inflation dropped for the second month in a row in July. However, this is not yet the end of surging inflation rates," Brzeski said, noting that government relief measures driving that trend were only temporary.

Energy prices were 35.7% higher in July on the same month last year, the statistics office said. Both this and food prices - up 14.8% - were fuelling overall high inflation, it added.

Earlier on Thursday, the Ifo institute said inflation in Europe's largest economy may have peaked, citing a survey that showed the number of German companies planning to increase prices had fallen for a third consecutive month in July.

But LBBW economist Jens-Oliver Niklasch warned the worst may not be over. "I wouldn't go so far as to say we've reached the high point yet," he said, citing uncertainty over energy costs.

The German government is planning to enact a levy on all gas consumers from October so that suppliers can pass on soaring gas import prices caused by the dearth in supply from Russia.

Measures to counter the high cost of living, such as a fuel tax cut and cheaper public transport, are set to expire from September.

Chancellor Olaf Scholz last week promised further help for low-income households to shoulder spiralling energy costs.

(Reporting by Rachel More, Paul Carrel and Reinhard Becker; Editing by Maria Sheahan, Miranda Murray and Catherine Evans)