President Donald Trump is taking aim at the nation's largest oil companies after both ExxonMobil and Chevron posted massive second-quarter profits while Americans continue paying more at the gas pump.

Speaking with reporters at the White House, Trump accused the companies of cashing in on supply disruptions caused by the ongoing conflict with Iran and said consumers deserve relief.

"They're making too much money based on a shortage, I don't like it," Trump said.

He also called on the oil giants to lower gasoline prices.

"They're going to give some of that back to the public," he said. "And they better cut the retail price, the consumer price."

The comments came just days after ExxonMobil reported $14.5 billion in second-quarter profit, more than double what it earned during the same period last year. Chevron posted $12 billion in net income, nearly five times higher than a year ago.

The companies' earnings were fueled in part by elevated oil prices as fighting with Iran continues to disrupt global energy markets and commercial shipping through the Strait of Hormuz.

Chevron CEO Mike Wirth said the company is operating at full strength despite the uncertainty.

"We're kind of firing on all cylinders, which is good, because the world needs it," Wirth told CNBC.

According to CNBC, Chevron's U.S. production reached a record two million barrels of oil per day during the quarter as exports continued to grow.

Even with increased production, drivers are still seeing higher fuel costs. AAA reported Tuesday that the national average price for regular gasoline reached $4.08 per gallon, up more than a dollar from before the conflict began, when prices hovered around $3.

Oil prices have swung sharply throughout the conflict, briefly climbing above $100 per barrel before easing. Early Tuesday, Brent crude was trading just below $82 per barrel.

Energy analysts say one of the biggest factors affecting prices remains the Strait of Hormuz, a critical shipping route for global oil supplies. A full reopening of the waterway would likely ease pressure on energy markets by allowing shipments to move more freely.

Treasury Secretary Scott Bessent said he believes an agreement with Iran could be reached as soon as Tuesday or Wednesday, potentially allowing commercial shipping to safely resume through the strait.

Trump's criticism also underscores the political stakes of rising fuel prices ahead of the midterm elections.

"Trump is acutely aware of the political consequences, with the midterms fast approaching, that high oil and high retail gasoline prices make things more difficult on incumbents, particularly Republicans," Glenn Schwartz, director of energy policy at Rapidan Energy Group, told The Wall Street Journal.

Public concern over gasoline prices has also intensified. A Pew Research survey of 3,554 U.S. adults conducted last month found worries about fuel costs "have risen sharply since January," with economic issues once again becoming a top concern for many voters.