The S&P 500 added 0.4%. The Dow Jones Industrial Average was up 524 points, or 1%, as of 12:41 p.m. Eastern time, while more swings for the artificial-intelligence industry had the Nasdaq composite up a more modest 0.2%.
Stock prices tend to follow the path of corporate profits over the long term, and several companies delivered results for the latest quarter that were better than analysts expected.
Stocks also got a lift after the price for a barrel of Brent crude erased an early gain to fall 0.8% to $108.69. Earlier in the morning, it got near $112 and approached its highest price since the war with Iran began in late February.
The drop in oil prices will relieve some of the pressure on inflation, if it lasts. Brent's price has been yo-yoing between $97 and $112 per barrel this month on uncertainty about when the energy industry will return to normal.
For now, airlines and other companies with big fuel bills enjoyed the benefit of Tuesday's drop. American Airlines rallied 4.8%, and United Airlines flew 3% higher.