NEW YORK (AP) — The U.S stock market motored to more records Thursday as profits keep piling up for Alphabet, Caterpillar and other big businesses. The gains came after the latest whipsaw moves for oil prices, which surged toward their highest levels since the war with Iran began only to quickly regress.

The S&P 500 rallied 1% and topped its prior all-time high to close out its best month in more than five years. The Dow Jones Industrial Average leaped 790 points, or 1.6%, while the Nasdaq composite climbed 0.9% to its own record.

Alphabet led the way and rallied 10% after the owner of Google and YouTube reported profit for the latest quarter that almost doubled analysts’ expectations. Investments in artificial intelligence “are lighting up every part of the business,” CEO Sundar Pichai said.

It’s the latest company to deliver fatter profits for the start of 2026 than analysts expected, even with very high oil prices and uncertainty about the economy.

Wall Street’s strength followed manic swings in the oil market, where prices surged overnight on worries that the Iran war will affect the flow of crude for a long time. Iran has closed the Strait of Hormuz to oil tankers, keeping them pent up in the Persian Gulf and away from customers worldwide, while a U.S. Navy blockade is preventing Iran from selling its own oil.