Tuesday's performance capped off a strong year for stocks. The S&P 500 was up 28.9% for 2019, its biggest one-year gain since 2013, when it rallied 29.6%. The Nasdaq also had its best one-year performance in six years after rallying 35.2% in 2019. The Dow rose 22.3% in 2019, its best annual performance since 2017.

The S&P 500 climbed 0.3% to 3,230.78. The Nasdaq Composite also advanced 0.3% and ended the day at 8,972.60. The Dow Jones Industrial Average closed 76.30 points higher, or 0.3% at 28,538.44. Materials and energy were the best-performing sectors in the S&P 500, rising around 0.7% each. IBM, Cisco Systems and Apple led the Dow higher.

Stocks rose slightly on Tuesday as Wall Street wrapped up a banner year that saw equities surge to record highs, overcoming concerns about the economy and a trade fight with China.

"We climbed a wall of worry, from a growth slowdown and profits flat at best, trade concerns, potential impeachment, and high valuations bothering investors — including myself," said Ned Davis, founder of Ned Davis Research, in a note.

Stocks surged in 2019 despite the ongoing U.S.-China trade war as the Federal Reserve cut rates three times while consumer sentiment remained high. Trade tensions also declined in the fourth quarter after China and the U.S. agreed to sign a so-called phase one trade deal.

"That one's in the bank," White House advisor Peter Navarro told CNBC's "Squawk Box" on Tuesday, referring to the phase-one agreement. "We're just waiting for the Chinese translation of the 86-page agreement and I'm trying to figure out whether it's going to be more pages or less in Chinese."

President Donald Trump later said he will sign the agreement on Jan. 15 at the White House.

Tweet

"By any objective measure US large cap stocks start 2020 on perilous footing. Valuations are rich. Corporate debt levels are at record highs," said Nicholas Colas, co-founder of DataTrek Research, in a note. "But… we know the Federal Reserve has learned its lesson. It will be quick to ease if necessary and slow – very slow – to raise rates."

Apple and Microsoft led the way higher for stocks in 2019, rallying 86.2% and 55.3%, respectively. They are the best-performing Dow stocks of the year and accounted for about 15% of the S&P 500's overall gains for 2019.

Chipmakers Advanced Micro Devices, Lam Research and KLA Corp. were the best-performing S&P 500 stocks in 2019. AMD and Lam Research both rose more than 100% for the year while KLA surged 99.1%. Retailer Target and fast-casual dining chain Chipotle Mexican Grill also rallied more than 90% this year.

Tuesday also marked the final trading day of the decade. Over the past 10 years, the S&P 500 has surged more than 188%. The broad index's total return — which includes dividends — tops 255% for the decade.

—CNBC's Silvia Amaro contributed to this report.