By Don Nico Forbes

French and Italian inflation cooled more than expected in June, suggesting price pressures are beginning to soften amid falling energy costs due to easing tensions between the U.S. and Iran.

In France, consumer price growth slowed to 2.0% on year from 2.8% in May, according to EU-harmonized data published by French statistics agency Insee on Tuesday.

A consensus of economists polled by The Wall Street Journal had expected a smaller decline to 2.3%.

The decline was driven by a sharp slowdown in energy prices, particularly those of petroleum products, Insee said, adding that services prices also slowed to a lesser extent.

Italian inflation slowed to 3.0% from 3.2%, according to statistics agency Istat. Economists expected the rate of inflation to remain unchanged.

The easing in inflation follows a significant fall in energy prices over the month of June. Oil prices declined in anticipation of a tentative peace deal between the U.S. and Iran in mid-June, and have since fallen to their lowest levels since the conflict began, with markets increasing bets on a resumption of regular flows through the Strait of Hormuz.

Cooler inflation comes as a welcome sign for the European Central Bank, which earlier in June raised interest rates for the first time in almost three years, becoming the first major central bank to take action to tackle rising prices driven by the war in Iran.

Still, policymakers are expected to remain cautious as they assess whether recent energy-driven price pressures prove temporary or have longer-lasting price effects.

ECB President Christine Lagarde said Tuesday that the decision to hike interest rates was based on the bank's inflation projections, with its forecasts showing that inflation in the eurozone would remain above the 2% target through 2027 and 2028 without tighter policy.

In May, core inflation--which strips out volatile energy and food prices--jumped unexpectedly to 2.5%, highlighting the risks of higher oil prices spreading beyond energy markets.

Meanwhile, renewed tensions in the Middle East in recent days have raised concerns that disruption to shipping through the Strait of Hormuz could prove more prolonged than markets had anticipated after news of the interim peace agreement, keeping energy prices in the spotlight.

On Monday, data showed that inflation in Spain remained stronger than anticipated in June, with electricity and gas maintaining upward pressure on prices.

Inflation numbers for Germany are due later Tuesday, while figures for the eurozone as a whole will be published Wednesday.

Write to Don Nico Forbes at don.forbes@wsj.com