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 rose 150.52 points, or 0.73 percent, to 20,701.5, the S&P 500 gained 16.98 points, or 0.73 percent, to 2,358.57 and the Nasdaq Composite 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 jumped 1.4 percent, with JPMorgan and Bank of America giving big boosts to the S&P 500. Energy shares gained 1.3 percent, supported by stronger oil prices.

The Dow Jones Transport Average, seen by some as a barometer of the economy, gained 1.8 percent for its second-best day of the year.

Apple 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 rose 2.4 percent after activist investor David Einhorn’s Greenlight Capital urged the carmaker to split its stock into two classes.

Tesla rose 2.7 percent after disclosing that Chinese technology giant Tencent Holdings had taken a 5 percent stake in the electric car maker for $1.78 billion.