NEW YORK (AP) — U.S. stocks rose Thursday, even though oil prices did too, as financial markets moved more modestly a day after surging on optimism about a ceasefire in the war with Iran.

The morning began with moderate losses for Wall Street following drops for Asian and European stocks. But the S&P 500 erased its dip and finished with a 0.6% gain after Israel’s prime minister authorized direct negotiations with Lebanon. That eased worries that the two-week ceasefire announced late Tuesday may already be in trouble because of Israel’s bombardment of Lebanon.

The Dow Jones Industrial Average added 275 points, or 0.6%, and the Nasdaq composite climbed 0.8% after both indexes likewise recovered from early losses.

Crude oil prices pared some of their gains, but they nevertheless remained higher for the day on uncertainty about when oil tankers can start fully flowing through the Strait of Hormuz. The narrow waterway has been at the center of President Donald Trump’s demands of Iran, and blockages there have kept oil and natural gas stuck in the Persian Gulf and away from customers worldwide.

The price for a barrel of benchmark U.S. crude rose 3.7% to settle at $97.87 after briefly nearing $103 in the morning. Brent crude, the international standard, added 1.2% to $95.92 per barrel.