(AP) -- Wall Street capped a broad rally for stocks Thursday by driving the S&P 500 index to an all-time high.
The milestone, which eclipsed the benchmark index's last record close on April 30, underscores a swift rebound for the market in June that has erased the losses from a 6.6% dive in May. The major U.S. stock indexes are up more than 7% so far this month.
Thursday's rally came as investors balanced optimism over the possibility that the Federal Reserve will cut interest rates in response to a slowing global economy with jitters about the prospects of dimmer corporate profits should a severe slowdown take hold.
Those worries prompted traders to shift money into safe-haven assets this week, such as gold and U.S. government bonds. The yield on the 10-year Treasury briefly slid Thursday as low as 1.97% after falling a day earlier to 2.02%. The yield, which is used to set interest rates on mortgages and other loans, is the lowest it's been since November 2016.
The price of gold, meanwhile, jumped 3.6%.
"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."
Investors' jitters over escalating tensions between the U.S. and Iran sent the price of U.S. crude oil 5.4% higher. Crude prices had been in a bear market just weeks ago, what Wall Street calls a drop of 20% or more.
The S&P 500 climbed 27.72 points, or 0.9%, to 1,954.18, a record high.
The Dow Jones Industrial Average rose 249.17 points, or 0.9%, to 26,753.17. The Nasdaq gained 64.02 points, or 0.8%, to 8,051.34. The Russell 2000 index of smaller companies picked up 7.92 points, or 0.5%, to 1,563.49.
Major stock indexes in Europe also finished higher.
Despite uncertainty over the global economy, the lingering U.S. trade war with China and the prospect of geopolitical conflict with Iran, stock investors have been in a buying mood this month. That's been a marked reversal from May, when jitters over the escalating trade conflict between Washington and Beijing derailed the market's strong start to the year.
The market's recovery gained momentum this week after the central bank said on Wednesday that it stands ready to cut interest rates. Traders also grew more hopeful that trade talks between the U.S. and China may make progress this month.
The top U.S. trade negotiator is scheduled to meet with his Chinese counterpart to discuss a trade dispute between the world's two biggest economies before a summit next week in Japan between Presidents Donald Trump and Xi Jinping of China. The market has rallied in the past and then dipped again because of seemingly good news on trade talks that did not result in any concrete progress.
Technology stocks accounted for a big share of Thursday's gains. Oracle led the sector, and all stocks in the S&P 500, jumping 8.2% after the software company reported solid financial results.
Industrial companies also notched solid gains. United Rentals climbed 3.4%.
The spike in oil prices sent energy sector stocks broadly higher. Noble Energy gained 6.2%.
Benchmark crude oil rose 5.4% to settle at $56.65 a barrel. Brent crude oil, the international standard, rose 4.3% to close at $64.45 a barrel.
Crude prices surged as tensions between the U.S. and Iran intensified, stoking fears that oil shipments through the Strait of Hormuz could be compromised. Iran's Revolutionary Guard said it shot down a U.S. drone on Thursday over Iranian airspace. The drone shooting follows last week's attack on two oil tankers near the Gulf of Oman.
Bond yields continued to slide a day after the Federal Reserve signaled that it is prepared to cut its benchmark interest rate if needed to shield the U.S. economy from trade conflicts or other threats. While the central bank left interest rates unchanged, investors are betting on at least one interest rate cut this year.
After sliding for much of the day, the yield on the 10-year Treasury note inched up to 2.03% from 2.02% late Wednesday.
"That's kind of confirming investors' nervousness and search for safety," Bell said. "At the same time, you have the stock market rallying because history has shown once the Fed starts cutting rates, six to 12 months after that you do get a rally in the equity market."
Another factor driving demand for U.S. Treasurys is that government bonds in Germany and other countries are returning negative yields, making U.S. bonds more attractive.
Shares in work messaging platform Slack surged in their stock market debut. The company's shares opened trading at $38.25 and closed 48.5% higher. Ride-hailing companies Uber and Lyft, video conferencing company Zoom Video Communications and digital scrapbooking site Pinterest have all gone public in recent weeks.
In other commodities trading, wholesale gasoline rose 2.9% to $1.79 per gallon. Heating oil climbed 3% to $1.88 per gallon. Natural gas fell 4% to $2.19 per 1,000 cubic feet.
Gold rose 3.6% to $1,396.90 per ounce, silver also rose 3.6% to $15.49 per ounce and copper rose 1.2% to $2.71 per pound.
The dollar fell to 107.27 Japanese yen from 107.97 yen on Wednesday. The euro rose to $1.1295 from $1.1245.