Stocks are on pace to log their best year of gains since 2013, and if history serves as a guide, the bullish momentum should continue through the next 12 months.

Michael Nagle | Bloomberg | Getty Images

Stocks surged in 2019, with the S&P 500 jumping about 29%, logging 35 record closes as market sentiment remains high amid easing tensions over U.S.-China trade relations. The world’s two largest economies agreed earlier this month to a so-called phase one trade deal. President Donald Trump plans to sign the deal with China at the White House on Jan. 15.

According to CNBC analysis using hedge fund trading tool Kensho, the S&P has had similar gains of at least 25% in a year on six other occasions. Following those moves, the trend continues with the index adding another 15% on average the following year, trading positively 100% of the time.

The S&P tech sector led the markets higher, up about 48% this year, with Apple and Microsoft in front, rallying 84.4% and 55.2%, 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.

The financials and communication services sectors also outperformed, gaining 31% and 30%, respectively.

The tech sector tends to lead as well, gaining 33% the next year, also trading positively in every instance.

This year’s big gains came despite Monday being the market’s worst day since early December. The Dow dropped 183 points, or 0.6%, pulling the S&P 500 and Nasdaq back 0.5% and 0.6%, respectively. Stocks were little changed on Tuesday.