Stocks closed at session highs Wednesday, with the Dow up 200 points and S&P within 1 percent of hitting its record, after Senate leaders announced a long-awaited compromise to raise the debt ceiling and put an end to the government shutdown.
(Read more: After-hours buzz: IBM, Ebay, AmEx & more)
The agreement came just one day before the Treasury was expected to exhaust its ability to borrow more money.
"There's some potential for 'sell the news'—when we resolve the issue in Washington, we're going to have to focus on the fundamentals and earnings season, and those haven't been a resounding success to this point," said Bruce McCain, chief investment strategist at Key Private Bank. "And the Beige Book suggests that people have become somewhat cautious in spending and investing because of the debt crisis."
(Read more: Watch Art Cashin: Post-debt deal dip possible)
The Dow Jones Industrial Average shot up 205.82 points, or 1.36 percent, to end at 15,373.83, boosted by Goldman Sachs and JPMorgan.
The S&P 500 jumped 23.48 points, or 1.38 percent, to close at 1,721.54. The S&P 500 is less than 1 percent away from its record high of 1,729.86 reached on Sept. 19.
And the Nasdaq rallied 45.42 points, or 1.20 percent, to finish at 3,839.43.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, tumbled near 15.
All key S&P sectors remained firmly in positive territory, lifted by financials and health care.
Senate Majority Leader Harry Reid and Republican leader Mitch McConnell announced the agreement around midday, where it was expected to win approval after a main Republican critic of the deal, Senator Ted Cruz of Texas, said he would not use procedural moves to delay a vote.
The deal would extend U.S. borrowing authority until Feb. 7, although the Treasury Department would have the means to temporarily extend its borrowing capacity beyond that date if Congress failed to act early next year. It would also fund government agencies until Jan. 15.
(Read more: Reid: Deal reached on ceiling, shutdown—for now)
Spokesman Jay Carney briefed reporters on President Obama's endorsement of the bipartisan Senate deal, saying the agreement will reopen the government and remove the threat of a debt default.
(Read more: Three things that worry Marc Faber more than DC)
Meanwhile, the Federal Reserve said that growth in the U.S. continued at a "modest to moderate pace'' in September and early October, though confidence had been tempered by uncertainty in Washington.
After the closing bell on Tuesday, Fitch credit rating agency placed the United States' triple-A rating on "rating watch negative," citing the ongoing debt ceiling gridlock. Fitch's move echoed a similar action by Standard & Poor's in August 2011, when the ratings agency downgraded the U.S. credit rating because of political gridlock related to the debt ceiling.
(Read more: Buffett: Would be'asinine' if US forced to default)
On the economic front, homebuilder sentiment slipped to 55 in October, touching the lowest level since June, according to the NAHB/Wells Fargo Housing Market Index, amid worries over Washington and higher labor costs. Economists polled by Reuters had predicted the index would remain flat at 58.
Among earnings, Bank of America advanced after the financial giant reported earnings that topped expectations and reversed a year-ago loss, as provisions for credit losses declined.
PepsiCo gained after the beverage and snack maker posted higher earnings and said it was on track to meet its financial goals for the year, despite the lackluster economy.
United Rentals rallied after the equipment rental company posted earnings that topped expectations. In addition, the company authorized a $500 million share repurchase program. The company was expected the post results after market close.
"We're trading closer to all-time high levels, but earnings are also at all-time highs…there's still value in the market and while DC is creating a headwind for a lot of companies, we will continue to see earnings growth" said Karyn Cavanaugh, market strategist at ING U.S. Investment Management.
Cavanaugh recommended buying equities on dips and has a 1,760 target for the S&P 500 by year end.
Advance Auto Parts surged more than 16 percent after the auto parts retailer said it will acquire General Parts International in a deal worth over $2 billion.
Apple rose above $500 a share, shrugging off a report from the Dow Jones that the tech giant was cutting orders for its low-cost iPhone 5C, raising concerns over weak demand. On Tuesday, the iPad maker announced that Burberry CEO Angela Ahrendts will join Apple as senior vice president of retail and online sales next year.
(Read more: Apple cuts 5C orders on weak demand: Report)
Cloud-based software company Veeva Systems surged 85 percent in its trading debut after pricing its IPO at $20 a share, well above its expected range.
Late Tuesday, Twitter chose the New York Stock Exchange for its much-talked-about stock market debut. The social-media company has also selected Nov. 15 as a tentative date to begin trading, people familiar with the matter told CNBC. The stock will trade under the ticker symbol "TWTR."
Tech companies have traditionally gravitated toward Nasdaq, but several glitches, including during Facebook's IPO, have made some rethink.
—By CNBC's JeeYeon Park (Follow JeeYeon on Twitter: @JeeYeonParkCNBC)
Coming Up This Week:
THURSDAY: Fed's Fisher speaks, jobless claims, housing starts*, industrial production*, Philadelphia Fed survey, natural gas inventories*, oil inventories*, Fed's Kocherlakota speaks, Fed's balance sheet/money supply, US debt ceiling deadline, Windows 8.1 available, Dell annual shareholder mtg; Earnings from Goldman Sachs, Verizon, Google, Capital One, Chipotle Mexican Grill
FRIDAY: Leading indicators; Earnings from General Electric, Schlumberger, Morgan Stanley, Honeywell
*Data will not be released due to the government shutdown.
What's Trending on CNBC.com: