If history is an indication, the stock market could extend its rally into 2014.
U.S. stocks are up for a sixth-straight session, with the Dow gaining 3.4 percent, or its strongest six-day win streak since March 2012. So far this year, the S&P 500 is up 29 percent, on pace for its best yearly performance since 1997, while the Dow is up 25 percent, or its biggest annual gain in a decade.
The strength of the rally has been felt across the board. In fact, the Dow closed at a record 20 percent of the time in 2013, and 17 percent for the S&P 500.
The Dow is on pace for five years of consecutive gains, up 87 percent in that period—the best five-year increase since 2000.
Other major indexes like the Nasdaq Composite, Dow transports, Russell 2000 and S&P Midcap 400, are up more than 30 percent year-to-date, respectively.
But the rally may not be over. Since 1950, there have been 17 other instances when the S&P 500 was up more than 20 percent in a year. The index finished positive the following year 14 times, or 82 percent of the time.
When positive the following year, it finished with a gain of least 7 percent 12 times or 86 percent of the time.
Below is a look at how the market performed after closing a year with a gain of at least 20 percent.