On the economic front, groundbreaking on new U.S. homes increased more than expected in April, according to the Commerce Department, as declining interest rates provided support to the struggling housing sector.

The S&P 1500 Homebuilding index advanced 1.2%.

In a separate report from the Labor Department, 16,000 fewer Americans applied for unemployment last week, beating economist estimates.

"If you look at the overall economy, we're in a fundamentally strong position and this is a reinforcement of that," said Matthew Keator, managing partner in the Keator Group, a wealth management firm in Lenox, Massachusetts.

Electric automaker Tesla Inc dropped 1.6% following safety agency reports that the Autopilot feature was engaged during a fatal crash in Florida in March.

Ride-hailing rivals Uber Technologies and Lyft Inc posted their third straight day of gains after spending much of their post-debut trading days in negative territory. Their shares were up 4.1% and 2.9%, respectively.

The Dow Jones Industrial Average rose 214.66 points, or 0.84%, to 25,862.68, the S&P 500 gained 25.36 points, or 0.89%, to 2,876.32 and the Nasdaq Composite added 75.90 points, or 0.97%, to 7,898.05.

All 11 major sectors in the S&P 500 were trading in positive territory, with materials, financials and consumer discretionary seeing the largest percentage gains.

A mostly upbeat first-quarter earnings season is beginning to wind down, with 457 S&P 500 companies having reported. Of those, about 75% have beaten profit expectations, according to Refinitiv data.

Analysts now expect first-quarter earnings growth of 1.4%, a significant improvement over the 2% loss expected on April 1.

Nvidia Corp was up over 4% in after-market trading after the Huawei Technologies supplier posted quarterly earnings.

Pinterest Inc dropped more than 12% in extended trading after posting results.

Advancing issues outnumbered declining ones on the NYSE by a 2.19-to-1 ratio; on Nasdaq, a 1.44-to-1 ratio favoured advancers.

The S&P 500 posted 51 new 52-week highs and 2 new lows; the Nasdaq Composite recorded 92 new highs and 69 new lows.

Volume on U.S. exchanges was 6.56 billion shares, compared to the 6.98 billion average over the last 20 trading days.