The gained 0.9 percent to finish at 2,802.56, with staples and tech rising more than 1 percent. The index also posted a record close.Tech stocks got a boost from Apple, which erased losses after announcing plans to r epatriate billions in overseas cash . The stock closed 1.7 percent higher.

The Dow Jones industrial average rose 322.79 points, closing above 26,000 for the first time. The index first broke above the milestone mark on Tuesday.

Stocks traded higher on Wednesday following the release of stronger-than-expected quarterly results from some of the biggest U.S. companies.

Bank of America reported adjusted quarterly earnings that surpassed analyst estimates. U.S. Bancorp also posted better-than-expected results.

Earnings season is off to a strong start thus far. Of the S&P 500 companies that had reported as of Wednesday, 78 percent have surpassed earnings-per-share estimates while 89 percent have beaten expectations on the top line, according to Nick Raich, CEO of The Earnings Scout.

"You've got a bullish start to the earnings season and earnings are expected to be strong for 2018," said Adam Sarhan, CEO of 50 Park Investments. He added: "The very strong underlying trend for the market remains in place."

Equities closed lower on Tuesday after a sharp reversal from record levels. The Dow closed 10 points lower after rising as much as 283 points and breaking above 26,000 for the first time.

Robert Pavlik, chief investment strategist at SlateStone Wealth, said there were concerns in the market that stocks had risen too much too quickly. "The government shutdown played right into that," he said.

The reversal took place as concerns of a government shutdown loomed over investors' minds. Congress needs to pass a spending bill by the end of Friday to avoid a government shutdown.

"Basically, what you saw was a market digesting strong gains," said Tom Essaye of The Sevens Report. "We're up 4 percent and we're still in January. When you see this, the market looks for a reason to consolidate."

Essaye also noted that, even if the government experiences a shutdown, "that's not going to deter from the strength in the economy and in earnings."

Elsewhere, shares of Juno Therapeutics spiked 51.8 percent higher after The Wall Street Journal reported the company was in talks to be acquired by Celgene.