Germany’s annual rate of inflation fell in June, confirming the first estimate, as there was a respite because of temporary government interventions.

According to final data released by German statistics office Destatis on Wednesday, consumer prices rose 7.6% on year measured by national standards, in line with the forecast by economists in a Wall Street Journal poll. In May, consumer prices rose 7.9%, posting the highest reading since December 1973.

Prices rose 8.2% on year by European Union-harmonized standards.

Month over month, consumer prices rose 0.1% by national standards and fell 0.1% by EU-harmonized standards, both in line with the forecasts of economists polled by The Wall Street Journal.

Since Russia’s attack on Ukraine, energy prices have markedly increased and have had a considerable impact on the high rate of inflation, Destatis said. Energy prices rose 38.0% in June on year, following a 38.3% increase in May. Food prices also increased above average, posting a 12.7% on-year increase, Destatis said.

Excluding energy prices, the inflation rate in June would have been 4.2%. Excluding energy and food, the annual inflation rate stood at 3.2% in June.

Other factors pushing inflation higher are supply-chain problems due to the Covid-19 pandemic and significant price increases as the economic recovery got under way, Destatis said.

The prices of goods were up 14.0% in June on year. The prices of nondurable consumer goods increased 18.6% and those of durable consumer goods rose 5.5%.

The prices of services were up 2.1% compared with the previous year, down from 2.9% in May, thanks to the introduction of the “9 euro ticket”, Destatis said.

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