US Markets

S&P 500 logs fresh high, Dow recovers from triple-digit drop to end flat; IBM falls 6%

Weak revenues drag Dow down: Pisani

Stocks staged an impressive recovery Thursday, with the S&P 500 setting a fresh high and the Dow erasing a triple-digit loss to finish near the flatline.

(Read more: After-hours buzz:Google, Capital One, AMD & more)

"You don't have to worry about the government anymore, and couple speed bumps are out of the way," said Dan Greenhaus, chief global strategist at BTIG.

Major U.S. Indexes

The Dow Jones Industrial Average closed down just 2.18 points to close at 15,371.65, pulling off a stunning comeback after being down sharply for most of the day.

IBM was the biggest laggard on the blue-chip index after the tech company posted a 4-percent drop in third-quarter revenue, disappointing expectations, amid a hardware decline and emerging market weakness. Additionally, at least 11 brokerages slashed their price targets on the company.

(Read more: Here's the worst thing about IBM's earnings report)

The gained 11.61 points to finish at a fresh high of 1,733.15. Meanwhile, the Nasdaq rose 23.71 points to end at 3,863.15, hitting a fresh 13-year high.

The small-cap Russell 2000 index hit a new all-time record.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, slumped below 14.

Most key S&P sectors closed in positive territory, lifted by telecom sand materials. Techs finished in the red, but well off its lows.

DC-proof stock picks

The deal will fund government agencies until Jan. 15 and extend the government's ability to borrow until Feb. 7. The Office of Management and Budget said that furloughed federal workers should report to work on Thursday morning, and Congressional leaders began to appoint budget negotiators to find a longer-term budget solution.

President Obama said the government shutdown slowed economic growth and damaged America's credibility.

"There are no winners here — these last few weeks have inflicted completely unnecessary damage on our economy," he said. "We don't know yet the full scope of the damage, but every analyst out there believes it slowed our growth."

(Read more: Washington now the biggest risk to the US economy?)

The dollar declined against a basket of major currencies, while gold zipped higher to a one-week high of nearly $1,320 an ounce.

"There were some gyrations along the way, but I think things had been priced in all along because people were expecting a deal in the end—we'll now be focusing on third-quarter earnings and fourth-quarter guidance," said Matt Kaufler, portfolio manager of the Clover Value Fund at Federated Investors. "We're likely to see further choppiness in the market, but I'd say we still have room for another 5 to 7 percent upside from here until year end."

Treasury Secretary Jack Lew welcomed the action, but said the government faced further challenges to get the U.S. economy back on track.

Analysts also warned that the deal merely delayed the need for government to make hard decisions.

"The good news for markets is that it seems highly unlikely that the Federal Reserve will risk tapering in December or January assuming the next budget negotiations go close to the wire again… it could be March at the earliest for tapering, which would continue to keep assets on the expensive side for the coming few months at least," said Deutsche Bank's Jim Reid in a note.

(Read more: $24 billion: Thereal cost of the shutdown)

Is Washington hurting Wall Street?

Earlier, Dallas Fed President Richard Fisher said the central bank cannot effectively combat high unemployment unless Congress and President Obama "get their act together" and fix the nation's fiscal problems.

"Kicking the can down the road for a few months will not solve the pathology of fiscal misfeasance that undermines our economy and threatens our future," Fisher said.

BlackBerry turned higher following a report from Dow Jones that Chinese PC and smartphone maker Lenovo is actively considering a bid for the handset company, according to sources.

Among earnings, newly-minted Dow component Goldman Sachs posted earnings that topped expectations, but revenue fell well below estimates, mainly due to weak bond-trading volumes, sending shares lower. Morgan Stanley, the last major financial company, is slated to post quarterly results Friday morning.

UnitedHealth also fell after the health insurance company posted earnings that matched Wall Street estimates, but revenue fell short of expectations.

Meanwhile, fellow Dow component Verizon climbed after the telecom company reported better-than-expected quarterly results, adding it expects wireless customer growth to improve sequentially in the fourth quarter.

Google, Capital One and Chipotle Mexican Grill are expected to post results after the closing bell.

(Watch: Art Cashin: Why I'm 'cautious' on earnings)

On the economic front, weekly jobless claims fell 15,000 to a seasonally adjusted 358,000, according to the Labor Department. California continued to deal with a backlog related to computer problems. Economists polled by Reuters had expected first-time applications to rise to 335,000 last week.

Meanwhile, factory activity in the mid-Atlantic region slowed slightly in October, but firms remained optimistic about the future, according to the Philadelphia Federal Reserve Bank.

—By CNBC's JeeYeon Park (Follow JeeYeon on Twitter: @JeeYeonParkCNBC)

Coming Up This Week:

FRIDAY: Leading indicators; Earnings from General Electric, Schlumberger, Morgan Stanley, Honeywell

What's Trending on