The S&P 500 financial index gained 1.1 percent and registered its biggest daily percentage gain since Feb. 15.

Benchmark 10-year note yields were steady on the day but above the level reached Monday, which was the lowest since December 2017.

The S&P 500's gains came after two sessions of declines, triggered by concern about slowing global economic growth and the inversion of a closely watched part of the Treasury yield curve.

"There was a stabilization in the bond market. What you don't want to see is the continuing inversion. The market is on yield watch, there's no doubt about it," said Quincy Krosby, chief market strategist at Prudential Financial in Newark, New Jersey.

If it persists, the yield curve inversion is seen as an indicator that a recession is likely in one to two years.

Also helping stocks, the S&P energy index jumped 1.5 percent, leading percentage gains among sectors, as oil prices rose on OPEC supply cuts and expectations of lower U.S. inventories.

The Dow Jones Industrial Average rose 140.9 points, or 0.55 percent, to 25,657.73, the S&P 500 gained 20.1 points, or 0.72 percent, to 2,818.46 and the Nasdaq Composite added 53.98 points, or 0.71 percent, to 7,691.52.

Apple Inc shares ended down 1 percent, reversing early gains, after a U.S. trade judge recommended Qualcomm Inc win a sales ban on some Apple iPhone models containing chips made by Intel Corp in one of two patent disputes.

Investors also digested weak consumer confidence numbers for March, as well as housing data that showed U.S. homebuilding fell more than expected in February.

Carnival Corp tumbled 8.7 percent after the world's largest cruise operator cut its annual profit forecast.

Advancing issues outnumbered declining ones on the NYSE by a 2.78-to-1 ratio; on Nasdaq, a 2.05-to-1 ratio favored advancers.

The S&P 500 posted 42 new 52-week highs and two new lows; the Nasdaq Composite recorded 44 new highs and 38 new lows.

Volume on U.S. exchanges was 6.55 billion shares, compared to the 7.66 billion average for the full session over the last 20 trading days.

(Reporting by Caroline Valetkevitch; additional reporting by Shreyashi Sanyal and Amy Caren Daniel in Bengaluru; Editing by Leslie Adler and Tom Brown)

By Caroline Valetkevitch