Dow is outperforming S&P, Nasdaq in a year when all three are positive

The Dow Jones industrial average is on track to do something it has done only twice in the past 20 years.

The blue-chip index, which has posted record closes for four straight sessions, had gained 8.6 percent year to date entering Wednesday's session, outperforming the S&P 500 and the Nasdaq composite, which were up 6.68 percent and 5.84 percent for the year, respectively. The last two times the Dow outperformed the S&P and Nasdaq in a year when all three were higher year to date were in 2006 and 1996.

A large chunk of the Dow's rally came after Republican Donald Trump shocked the world by winning the U.S. presidential election over Hillary Clinton. The index gained 3.79 percent between Election Day and Tuesday's close.

Peter Cardillo, chief market economist at First Standard Financial, said one of the main reasons for the Dow's sharp gains following the election is that the index leans more heavily toward financial and industrial stocks than the S&P and Nasdaq do. Those two sectors have outstripped most of the market since Election Day.

"This is a Trump rally. On Election Day, institutional investors got caught on the wrong side, and you've seen them make major portfolio switches," he said. "The industrials and financials have led the rally in the Dow, and that has been due to [the possibility of] higher-growth policies."

Shares of Goldman Sachs and JPMorgan Chase, two Dow components, surged 17.65 percent and 14.06 percent, respectively, between Election Day and Tuesday's close.

Dow (blue), S&P (green) and Nasdaq (violet) in 2016Source: FactSet

— CNBC's Peter Schacknow contributed to this report.