- Energy and tech stocks rose 0.7 percent and 0.8 percent, respectively.
- A rise in crude prices also gave energy a boost.
- The major indexes shook off news of the explosion that took place in Times Square earlier on Monday.
U.S. equities closed higher, reversing earlier weakness following a terror incident near New York City's Times Square.
The Dow Jones industrial average notched a record close, rising 56.87 points to 24,386.03. The S&P 500 gained 0.3 percent to finish at 2,659.99, an all-time closing high. Energy and tech stocks were among the best-performing sectors in the S&P 500, rising 0.7 percent and 0.8 percent, respectively.
"For the first time in this recovery, energy stocks appear significantly undervalued. They currently trade at a 32% discount to fair value," said Jim Paulsen, chief investment strategist at The Leuthold Group, in a note. "Maybe it's time to lighten up on some of your popular 2017 winners and reallocate toward a sector deeply out of favor."
A rise in crude prices also gave energy a boost. U.S. crude futures jumped 1.1 percent to settle at $57.99 per barrel on Monday. Brent futures also rose, hitting a 2½-year high.
The Nasdaq composite gained 0.5 percent, closing at 6,875.08.
The major indexes shook off news of the explosion that took place in Times Square earlier on Monday. A low tech device exploded during rush hour Monday morning at New York's Port Authority, injuring four people, including the man carrying the device. "This was an attempted terrorist attack," Mayor Bill de Blasio said at a news conference at the scene.
Stock futures pared gains after initial reports of the explosion broke. S&P 500 futures briefly turned negative. Treasurys rose, pushing the yield on the 10-year note to 2.38 percent.
"People recognize that these one-offs aren't that important, but it does remind them that there are risks out there," said Maris Ogg, president of Tower Bridge Advisors.
Stocks were coming off a strong session, with the S&P 500 and Dow posting record closing highs after the release of strong employment data. The nonfarm payrolls data for November revealed Friday that the U.S. had added 228,000 jobs last month, beating expectations of 200,000.
Wall Street also looked ahead to the upcoming monetary policy meeting by the Federal Open Market Committee (FOMC), to see if the central bank raises interest rates for the final time this year. The meeting starts Tuesday and the committee is scheduled to announce its decision on Wednesday.
"Markets are pricing in the near-certainty of a rate hike on Wednesday, continuing on the Fed's gradual tightening path," said Jason Pride, director of investment strategy at Glenmede. Pride also noted that "improving economies in the U.S. and elsewhere suggest that monetary policy normalization will happen globally."
In October, the that a rate hike during this month was all but certain, despite the low inflation that weighs on market sentiment.
Investors also kept a close eye on any developments coming out of the Trump administration as lawmakers try to overhaul the U.S. tax system.
"I think the initial buying and selling [on the tax plan] is done," said Tom Stringfellow, chief investment officer at Frost Investment Advisors. "Now it's about waiting for details on what kind of tax package we get."
Overseas, fluctuated around the flat-line, while finished in the black.
In corporate news, shares of Cboe Global Markets traded higher following the launch of bitcoin futures on the Cboe Futures Exchange. Cboe shares closed 0.9 percent higher. Bitcoin futures — which began trading at the Cboe on Sunday — surged 20 percent to $18,670 per bitcoin.
Overstock.com shares, meanwhile, surged 22 percent after Morgan Stanley revealed a stake in the company. Overstock shares have been on fire recently after the company said it plans to launch a licensed digital coin trading platform.