U.S. stocks finished nearly unchanged Thursday as investors weighed renewed Middle East supply concerns against signs that Washington and Tehran could be exploring a possible path toward ending the war.

The S&P 500 slipped 0.02% to 7,704.13, while the Nasdaq Composite gained 0.01% to 26,939.37. The Dow Jones Industrial Average fell 0.31%, closing at 51,349.98.

Brent crude climbed more than 3% to nearly $107 a barrel after a Houthi missile attack on Saudi Arabia renewed concerns about disruptions to global energy supplies. Investors also reacted to reports that U.S. and Iranian negotiators were discussing a phased arrangement that could involve Tehran reopening the Strait of Hormuz in exchange for Washington easing its economic blockade.

Higher oil prices added to inflation concerns and pushed Treasury yields higher. The 30-year Treasury yield reached its highest level since 2004, increasing the appeal of bonds relative to riskier assets such as stocks.

Technology stocks produced mixed results. Microsoft and Broadcom declined, while Advanced Micro Devices gained. Meta Platforms rose 4.5% after unveiling a small handheld device connected to its recently launched artificial intelligence assistant.

Oracle shares declined following a report that the company had issued a force majeure notice involving a New Mexico data center. Blue Owl, which is developing the project, also fell sharply.

Investors are also watching the Federal Reserve after stronger business activity data increased expectations for another interest rate increase. New York Fed President John Williams said Thursday that another rate hike before the end of the year could be reasonable, while traders were pricing in a roughly 70% chance of an increase at the Fed's October meeting.

The S&P 500 is trading at less than 19 times expected earnings, its lowest forward valuation since 2023, according to LSEG data. Much of the recent improvement in earnings expectations has been driven by major artificial intelligence companies.

MGM Resorts was among the day's larger decliners after media executive Barry Diller's People Inc. withdrew its proposal to acquire the casino operator. Meanwhile, investors remained focused on President Donald Trump's meeting with Chinese President Xi Jinping and the potential implications for trade and artificial intelligence.