Why is the stock market shrugging off the Iran war? Experts explain

The S&P 500 has hit multiple all-time highs during the Iran war.

The Iran war plunged the global economy into one of the worst oil crises in history. Gasoline prices in the United States vaulted to a 4-year high. Some economists ratcheted up their odds of a U.S. recession within the next year.

The stock market, however, responded with a shrug.

The S&P 500 -- the index that most people's 401(k) plans track -- has hit multiple all-time highs over the course of the war, including a fresh record as recently as Monday. Overall, the S&P 500 has climbed more than 3% since the U.S. and Israel attacked Iran on Feb. 28.

The tech-heavy Nasdaq has soared nearly 8% from its pre-war level. The Dow Jones Industrial Average has ticked down about 1%.

Sunny investor attitudes stem from robust corporate earnings, as well as milder economic fallout from the war than some forecasters feared, some analysts said. President Donald Trump, they added, has displayed a willingness to back off of actions if they threaten a severe market reaction, reassuring investors wary of a prolonged conflict, analysts added.

Uncertainty abounds, however, they cautioned. An ongoing oil shortage threatens to drive up prices for an array of products, putting a drag on the economy and eating away at company returns.

"Investors have bought and bought and bought," Steve Sosnick, chief strategist at trading firm Interactive Brokers.

But, he added: "The longer this goes on, the greater the risks."

The Middle East conflict prompted Iranian closure of the Strait of Hormuz, a maritime trading route that facilitates the transport of about one-fifth of global oil supply. Gasoline and crude prices soared as a result.

Despite the disruption, some measures of economic health have proven resilient, including corporate earnings.

Roughly 140 members of the S&P 500 have issued results so far this earnings season, beating analyst expectations at a rate 14% higher than they were a year ago, Bank of America said in a research note to clients shared with ABC News this week.

Bret Kenwell, an investing analyst at eToro, said strong corporate earnings have helped ease investor worries over the Iran war.

"The market appears to be looking past the Iran war because investors have another story to focus on: fundamentals," Kenwell told ABC News. "Earnings estimates have continued to climb despite the conflict."

Stocks moved higher on a largely consistent basis this month in response to an apparent willingness on the part of both sides to end fighting and negotiate a temporary truce. Since the U.S. and Iran reached a ceasefire on April 7, the S&P 500 has climbed nearly 7%.

"My outlook remains firmly bullish on U.S. stocks," Ivan Feinseth, a market analyst at Tigress Financial, told investors this week, pointing in part to the ongoing ceasefire.

Still, the Strait of Hormuz remains effectively closed, even though fighting has largely halted.

The Brent futures price, the benchmark index for global oil trading, registered at about $119 a barrel on Friday. That price stood nearly 70% higher than its pre-war level.

Oil prices remain below the highs reached after some previous economic shocks. In March 2022, the price of Brent crude surged above $139 per barrel, just weeks after the Russian invasion of Ukraine. During the 2008 financial crisis, U.S. gasoline prices shot up as high as $147 a barrel.

If the war continues to stretch on, oil costs will rise and economic fallout will worsen, Sosnick said. Eventually, he added, the stock market may turn sour.

Markets appeared to wobble on Wednesday as oil prices surged. As of midday, the Dow Jones Industrial Average had dropped about 340 points, or 0.4%. The S&P 500 fell 0.2%, while the Nasdaq declined 0.3%.

"It's not fair to assume that we can just skate past this war with few ill effects. The longer this persists, the harder it will be to rectify quickly," Sosnick said.