(Reuters) - U.S. stocks ended sharply higher on Tuesday, with financial and energy shares surging as data showed U.S. consumer confidence soaring to a more than 16-year high.
The S&P 500's best day in nearly two weeks came after a record-setting rally for stocks in the wake of President Donald Trump's election in November had stalled this month. The Dow Jones Industrial Average snapped an eight-day losing streak, which had been its longest run of losses since 2011.
U.S. consumer confidence surged to a more than 16-year high in March amid growing labor market optimism, while the trade deficit in goods narrowed sharply in February. The economy's strengthening fundamentals were bolstered by other data showing further increases in house prices in January.
The data "underscore what has been going on really in this whole rally, and that is that confidence is pretty high and optimism is high and that has kind of been underpinning the resiliency of the equity markets," said Jim Davis, regional investment manager at U.S. Bank Wealth Management in Springfield, Illinois.
The Dow Jones Industrial Average .DJI rose 150.52 points, or 0.73 percent, to 20,701.5, the S&P 500 .SPX gained 16.98 points, or 0.73 percent, to 2,358.57 and the Nasdaq Composite .IXIC added 34.77 points, or 0.6 percent, to 5,875.14.
Tuesday's gains follow declines last week as investors fretted over Trump's ability to enact his agenda after his fellow Republicans failed to pass their healthcare bill.
However, investors appear to have shrugged off the setback, choosing instead to focus on Trump's promise of reforming the U.S. tax code, which has been a key driver in the post-election record rally.
"You have got maybe some rethinking of the political calculus related to the demise of healthcare, but what that may mean for a quicker focus on tax reform," said Chuck Carlson, chief executive officer at Horizon Investment Services in Hammond, Indiana.
The financial and energy sectors, which have lagged the broader market this year, fueled the S&P 500 on Tuesday.
The financial sector .SPSY jumped 1.4 percent, with JPMorgan (JPM.N) and Bank of America (BAC.N) giving big boosts to the S&P 500. Energy shares .SPNY gained 1.3 percent, supported by stronger oil prices CLc1.
The Dow Jones Transport Average .DJT, seen by some as a barometer of the economy, gained 1.8 percent for its second-best day of the year.
Apple (AAPL.O) rose 2.1 percent and gave the biggest boost to the S&P and the Nasdaq, as the shares hit an all-time high.
In corporate news, General Motors (GM.N) rose 2.4 percent after activist investor David Einhorn's Greenlight Capital urged the carmaker to split its stock into two classes.
Darden Restaurants (DRI.N) jumped 9.3 percent, making it the best performer on the S&P 500, after the Olive Garden owner announced quarterly results and said it would buy Cheddar's Scratch Kitchen for $780 million.
Advancing issues outnumbered declining ones on the NYSE by a 2.91-to-1 ratio; on Nasdaq, a 1.63-to-1 ratio favored advancers.
The S&P 500 posted 18 new 52-week highs and 4 new lows; the Nasdaq Composite recorded 82 new highs and 33 new lows.
Additional reporting by Yashaswini Swamynathan in Bengaluru; Editing by Anil D'Silva and Dan Grebler