Stocks Log 3-Day Rally, Led by Materials; RIM Up 13%

Stocks reversed earlier losses to close higher for a third-straight session Tuesday, with the Dow and S&P 500 extending their recent multi-year gains, ahead of a busy week of corporate earnings and amid hope for a deal on the debt ceiling.

(Read More: After-Hours Buzz: GOOG, WFC & More )

S&P 500

The Dow Jones Industrial Average gained 62.51 points, or 0.46 percent, to close at 13,712.21, led by UnitedHealth and Alcoa. The Dow is up more than 4.5 percent so far this month, on pace for the best January performance since 1997 when the index rose 5.7 percent.

The Dow Jones Transportation Average rallied to a historic high for the fifth-straight session, soaring more than 8 percent in January, largely boosted by airlines.

The S&P 500 climbed 6.58 points, or 0.44 percent, to finish at 1,492.56. The Nasdaq eked out a gain of 8.47 points, or 0.27 percent, to end at 3,143.18.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, ended unchanged around 12. (Read More: S&P 1,500: The Last Barrier Before a New Record? )

Most key S&P sectors finished higher, led by banks and materials, while techs finished in the red.

Markets were closed Monday for Martin Luther King Day. On Friday, the Dow and S&P 500 climbed to finish the week at their highest levels since December 2007 and all three major averages logged their third-straight weekly gain. (Read More: Obama Lays Out Battle Plan as Second Term Kicks Off )

Microsoft is in talks to invest $1 billion to $3 billion as part of Dell's leverages buyout, sources told CNBC. Meanwhile, talks between Silver Lake Partners, one of the main sponsors in talks with Dell to help bring it private, and the special committee for Dell's shareholder are continuing and a deal is expected to be reached by the end of the week.

Among earnings, Verizon posted weaker-than-expected wireless operating profit margin . But shares gained after the CFO said the company could be in a position to buy back shares sooner than expected and that wireless margins could rise this year to as high as 50 percent.

DuPont and Travelers rose after both Dow components edged past Wall Street expectations.

Meanwhile, Johnson & Johnson reported a better-than-expected profit, but shares slipped after the drugmaker took another special charge and forecast 2013 earnings below estimates. (Click here for complete earnings coverage.)

Google, IBM, Texas Instruments and AMD are among major tech companies to report after the close. (Read More: Big Week Ahead for Tech Earnings )

So far, 74 S&P 500 companies have reported results this quarter, with 62 percent of firms topping earnings expectations and 68 percent beating revenue estimates.

"This week is so very important for the S&P 500 because the Nasdaq 100 is about 140 points off 2012 highs and lagging the major indices right now, and buyers don't want to see the technology sector—the Nasdaq in particular—lagging the major indices," according to Anthony Crudele, founder and CEO of E-mini Executors.

On the economic front, existing home sales declined 1 percent in December to a seasonally adjusted annual rate of 4.94 million units, according to the National Association of Realtors.

Boeing declined after the jetmaker said it will not deliver any new 787 jets until the Federal Aviation Administration approves a compliance method for its recent airworthiness directive on the jet's batteries. (Read More: Dreamliner Troubles Put Boeing on Edge)

Research In Motion soared to lead the Nasdaq 100 gainers after the BlackBerry maker's CEO commented about possible licensing deals and asset sales. And Paradigm Capital raised its price target on the smartphone maker to $19 from $14.50.

Apple closed higher, rebounding from earlier lows. Earlier, UBS and Scotiabank cut their price target on the iPhone maker to $650 and $600, respectively. Apple is scheduled to post earnings Wednesday. (Read More: Why Apple Loves the $500 Level: Pro )

Facebook rallied after Topeka upgraded its price target on the social-networking giant to $40 from $36 and maintained its "buy" rating. Facebook has surged more than 40 percent in the last six months.

European shares ended flat after recent market gains and as Deutsche Bank shares were hit by rumors about a profit warning and regulatory action. Asian shares ended mixed after the Bank of Japan (BOJ) announced a doubling of its inflation target to 2 percent and adopted a policy of open-ended monetary easing. (Read More: China Stock Rally Here to Stay: Charts )

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

Coming Up This Week:

WEDNESDAY: Weekly mortgage applications, FHFA home price index; Earnings from McDonald's, United Tech, Abbott Labs, Coach, WellPoint, Amgen, Apple, F5 Networks, Netflix, Sandisk, Symantec, Western Digital
THURSDAY: Jobless claims, PMI manufacturing index flash, leading indicators, oil inventories, Fed balance sheet/money supply; Earnings from 3M, Bristol-Myers, Nokia, Xerox, AT&T, Microsoft, E-Trade, Juniper Networks, Starbucks
FRIDAY: New home sales, Geithner's last day as Treasury Secretary, House recess until Feb. 4; Earnings from P&G, Halliburton, Honeywell, Kimberly-Clark

More From