Oil prices rose on Wednesday after President Trump told reporters that he planned to attack Iran again, after the United States and Iran traded new strikes across the Middle East.

The attacks, straining a two-month cease-fire between the countries, were the latest jolt to energy markets. The war in Iran has choked the Strait of Hormuz, which normally carries as much as one-fifth of the world’s oil.

The effects of rising oil prices were evident in the latest monthly inflation report, released on Wednesday, which showed a 4.2 percent increase in consumer prices in May versus last year — the fastest pace since April 2023. The rise was driven almost entirely by energy prices, which as a category has risen 23.5 percent over the year before.