The S&P 500 closed at a record high and has erased all of a steep pullback it suffered in May and more in Thursday’s Stock Market Update.

The rally came as investors balanced optimism over the possibility that the Federal Reserve could cut interest rates in response to a slowing economy and jitters about the prospects of dimmer corporate profits should a severe slowdown take hold.

The benchmark index was slightly above the record close it reached April 30. The rally came as investors balanced optimism over the possibility that the Federal Reserve will cut interest rates in response to a slowing global economy and jitters about the prospects of dimmer corporate profits should a severe slowdown take hold.

Those worries continued to fuel demand for U.S. government bonds, sending yields on the 10-year Treasury note down to 2%, the lowest level since November 2016.

“If the Fed is going to cut rates it means that the economic environment is slowing down,” said Lindsey Bell, investment strategist at CFRA. “You have investors looking to bonds to hide out in. You’re also seeing a big move up in gold on the back of the Fed’s decision as well.”

Traders also drove U.S. oil prices 5.4% higher as tensions between the U.S. and Iran escalated, stoking fears that oil shipments through the Strait of Hormuz could be compromised. U.S. crude oil prices had been in a bear market just weeks ago, what Wall Street calls a drop of 20% or more.

A strong rebound for stocks this month has erased the S&P 500’s losses from May, when jitters over the escalating trade conflict between the U.S. and China knocked the market into a 6.6% dive. The major U.S. stock indexes are up more than 7% so far this month.

The market’s recovery gained momentum this week after the central bank reiterated on Wednesday that it stands ready to cut interest rates. Traders also grew more hopeful this week that Washington and Beijing could eventually resolve their damaging trade war.

STOCK MARKET UPDATE

The S&P 500 rose 27 points, or 0.9%, to 2,954. The Dow Jones Industrial Average added 249 points, or 0.9%, to 26,753. The Nasdaq rose 64 points, or 0.8%, to 8,051.

Major stock indexes in Europe also rose.

Technology stocks accounted for a big share of Thursday’s gains. Oracle led the sector, climbing 8.1% after the software company reported solid financial results. Mastercard rose 2.6%.

The spike in oil prices sent energy sector stocks broadly higher. Noble Energy gained 6.1%.

Shares in work messaging platform Slack surged in their stock market debut. The company’s shares opened trading at $38.25 and were up 48.5% in afternoon trading. Ride-hailing companies Uber and Lyft, video conferencing company Zoom Video Communications and digital scrapbooking site Pinterest have all gone public in recent weeks.

Cruise line operators were among the few losers after Carnival slashed its profit forecast for the year. The company cited technical issues with its Vista ship. It also cited a ban on U.S. cruises to Cuban ports and an economic slowdown in Europe, which have broader implications for the sector. Carnival sank 7.6%, Royal Caribbean Cruises fell 3.1% and Norwegian Cruise Line slid 2.5%.

© The Associated Press. All rights reserved.