Wall Street rose sharply on Tuesday, elevating the S&P 500 to a modest gain for the year as Amazon and Apple led tech stocks higher.

All 10 major S&P sectors ended with gains, led by a 1.34-percent rise in the technology sector, its strongest performance since the start of the month.

Following a recent selloff over concerns about potentially soft iPhone sales, Apple jumped 1.80 percent and was the biggest influence on the S&P 500 and Nasdaq.

Amazon climbed 2.78 percent and closed at a record high of $693.97. The online retailer recorded more than 3 million new Prime memberships in the third week of December, indicating strong holiday demand.

The health index jumped 1.22 percent, led by a 1.26 percent gain in Pfizer.

"Tech stocks, and some healthcare stocks, can deliver top-line growth in a situation where a lot of other companies have to generate earnings through cost-cutting or share buybacks. What you’re seeing there is a bid for growth," said Bucky Hellwig, senior vice president at BB&T Wealth Management in Birmingham, Alabama.

Chevron rose 0.98 percent, helping push the S&P energy sector up 0.69 percent after oil prices edged up on the prospects of colder weather in Europe and North America, raising hopes of a short-term uptick in the tepid demand that has plagued the commodity this year.

Data on Tuesday indicated consumer sentiment was improving, with the Conference Board's index of consumer confidence for December up at 96.5, beating the 93.8 expected.

The Dow Jones industrial average ended 1.1 percent higher at 17,720.98 points while the S&P 500 gained 1.06 percent to 2,078.36.

The Nasdaq Composite added 1.33 percent to 5,107.94.

Trading was thin with many investors off for the holidays.

Volume on U.S. exchanges was 5.0 billion shares, compared to a 7.5 billion average over the last 20 trading days, according to Thomson Reuters data.

The S&P 500 has now rebounded 11 percent from a steep correction in August that was caused by turmoil in China's stock market and fears about a slowdown in its economic growth.

With two trading sessions left in 2015, the S&P 500 was up almost 1 percent for the year, while the Nasdaq Composite was up almost 8 percent. The Dow Jones industrial average, however, was down about 0.6 percent for the year.

Pep Boys rose 8.79 percent after the auto parts retailer's board found Carl Icahn's latest offer superior to the deal it accepted from Japan's Bridgestone.

Advancing issues outnumbered decliners on the NYSE by 2,270 to 798. On the Nasdaq, 1,976 issues rose and 859 fell.

The S&P 500 index showed 29 new 52-week highs and no new lows, while the Nasdaq recorded 82 new highs and 46 new lows.

(Additional reporting by Abhiram Nandakumar in Bengaluru; Editing by Nick Zieminski)