Markets began Thursday with moderate losses for U.S. stocks after declines earlier for Asian and European shares, but the tone shifted as Wall Street erased its dip and moved higher by the close. The advance came a day after a surge tied to optimism about a potential ceasefire in the Iran war, even as traders continued weighing whether the truce would hold.

The S&P 500 finished with a 0.6% gain after Israel’s prime minister authorized direct negotiations with Lebanon, a development that eased worries that a two-week ceasefire announced late Tuesday could already be in trouble because of Israel’s bombardment of Lebanon. The Dow Jones Industrial Average rose 275 points, or 0.6%, while the Nasdaq composite climbed 0.8% as both indexes recovered from early declines.

Oil prices pared some of their gains but still ended higher for the day amid uncertainty about when oil tankers can resume fully flowing through the Strait of Hormuz. The narrow waterway has remained central to President Donald Trump’s demands of Iran, and blockages there have kept oil and natural gas largely stuck in the Persian Gulf and away from customers worldwide.

Benchmark U.S. crude rose 3.7% to settle at $97.87 per barrel after trading briefly near $103 earlier in the day. Brent crude, the international benchmark, added 1.2% to settle at $95.92 per barrel.

Strategists cited in the reporting said upward pressure on oil prices may persist, given the distance between the United States and Iran’s demands. The risks include renewed fighting that could cause customers worldwide to hoard supplies, keeping oil off the market much like attacks on pipelines or oil tankers can disrupt distribution.

Brent crude had traded at roughly $70 per barrel before the war in late February and climbed to more than $119 at times, with prices swinging through sharp and sudden reversals as expectations for a full reopening of the Strait of Hormuz rose and fell. Even with the day’s volatility, the U.S. stock index at the center of many 401(k) accounts remained near record territory, with the S&P 500 still 2.2% below its January record.

Individual companies helped shape the day’s trading. Constellation Brands climbed 8.5% after reporting results for the latest quarter that beat analysts’ expectations, and it cited encouraging trends ahead of its new fiscal year while pulling its financial forecasts for the following year because of “limited near-term visibility” and other factors. CoreWeave rose 3.5% after announcing an expanded $21 billion deal with Meta Platforms to provide AI cloud capacity through December 2032, and Meta gained 2.6%.

On the downside, Simply Good Foods sank 18.1% after reporting a worse-than-expected drop in revenue. CEO Joe Scalzo described the results as unsatisfactory and said the company behind the Quest and Atkins brands was making immediate changes to turn around performance.

Wall Street’s pace also reflected mixed reports on the U.S. economy. One report showed an underlying inflation measure the Federal Reserve watches was slightly hotter in February than economists expected, with deceleration occurring before the Iran war began but not by as much as anticipated; a separate report said more U.S. workers applied for unemployment benefits last week than economists expected. The report said the applications figure was not high by historical standards but could indicate layoffs accelerating.

In bond markets, Treasury yields moved up and down following the data before ending near where they were the prior day. The yield on the 10-year Treasury edged down to 4.28% from 4.29% late Wednesday, the reporting said—still well above the 3.97% level before the war began, a shift that has contributed to higher mortgage and other loan rates for households and businesses.

The article also tied the rate outlook to energy prices, arguing that if oil stays high and continues pushing inflation upward, the Federal Reserve could find it harder to resume interest-rate cuts even if the job market weakens. It pointed to minutes from the Fed’s latest meeting released on Wednesday, saying a growing number of officials were considering the possibility of a hike in rates.

Outside the United States, global markets showed declines, with South Korea’s Kospi down 1.6% and Germany’s DAX down 1.1% for two of the world’s biggest movers. All told, the S&P 500 rose 41.85 points to 6,824.66, the Dow rose 275.88 points to 48,185.80, and the Nasdaq composite climbed 187.42 points to 22,822.42.