Stocks broke three consecutive sessions of losses to end higher amid light volume, led by financial and tech stocks, and as oil prices stabilized.
But the major indices ended the week with big percentage declines, ending a streak of gains that had lasted three weeks. Stocks still werein positive territory for the month and year.
The Dow Jones Industrial Average gained 61.95 points, or 0.5 percent, Friday, to close at 12,130.45. For the week, the blue-chip index fell 260.8 points, or 2.1 percent, the biggest weekly percentage drop since mid-November.
The S&P 500 gained 13.78 points, or 1.06 percent on Friday to close at 1,319.88. For the week, the broad market index fell 23.13 points or 1.72 percent, the biggest weekly percentage drop since mid-November.
The tech-heavy Nasdaq gained 43.15 points, or 1.6 percent, to close at 2,781.05. For the week, the Nasdaq fell 52.90 points or 1.9 percent, its biggest weekly percentage drop since the week of Jan. 21.
The CBOE Volatility Index, widely considered the best gauge of fear in the market, sank almost 10 percent to nearly 19 on Friday, but it rose nearly 17 percent for the week.
All key S&P 500 sectors were higher, led by financials, materials and technology. For the week, energy was the best performing sector, rising 1.07 percent as oil prices soared. Chesapeake Energy was the best performing energy stock, rising 16.2 percent for the week.
Industrials was the worst performing sector, down more than 3 percent for the week.
Volume on the consolidated New York Stock Exchange was 3.8 billion shares, while 945 million shares changed hands on the NYSE floor.
Oil prices traded flat, with U.S. light crude closing above $97 a barrel, after assurances from Saudi Arabia that it can pump more oil to cover for a fall in Libyan exports caused by the turmoil in the country. (Read More: Oil Could Hit $120 a Barrel: Boone Pickens)
Meanwhile, gold rose near $1,410 an ounceand was on pace for a fourth straight week of gains.
"I'm a bit surprised, but happy to see the market regain a significant chunk of the ground it lost earlier this week," said Michael Sheldon, chief market strategist at RDM Financial.
"There was every opportunity for the market to fall apart yesterday," Sheldon added, noting that the S&P 500 had bounced off the 50-day moving average of 1,289, and the DJ Transportation Index fell below 5,000. On Friday, the S&P 500 traded as high as 1,320, and the DJ Transportation Index is at about 5,056.
"It's too soon to sound the all clear yet," Sheldon says. "It's too soon to say the volatility in the Middle East is behind us."
In fact, investors on Friday were cautious not to be over-exposed heading into the weekend should conflicts in the Middle East flare up or expand, said Sal Arnuk, co-head of trading at Themis Trading.
"I can tell you generally in the market you are seeing more institutions lighten up on strength rather than buying strength," Arnuk said.
Tech stocks led the market higher following a handful of robust earnings from Salesforce and Autodesk.
Salesforce reported stronger-than-expected revenue growth and at least five brokerages raised their price targets for the maker of cloud computing applications. Meanwhile, Autodesk reported a profit which soared 23 percent on double-digit revenue gains throughout the computer software design company's businesses.
Several personal computer stocks also skyrocketed: Intel , Micron and AMD all gained, while the Philadelphia Semiconductor index rose nearly 2 percent.
Among financials, also big gainers for the day, Wells Fargo climbed after Goldman raised its rating on the stock to "buy" from "neutral," saying the bank could announce both a rise in its dividend and a stock buyback, while the brokerage cut Citigroup to "neutral," saying it doesn't see a near-term catalyst for the stock.
But AIG sank after investors raised concernsabout the insurer's property insurance and aircraft leasing businesses. AIG reported a profit of more than $11 billion in the fourth quarter, on asset sales, after the bell Thursday.
Energy stocks including Transocean , Schlumberger and Halliburton rebounded from the previous session's losses.
Elsewhere, Boeing led the Dow higher after the Pentagon announced that the aircraft maker won a contract to build new refueling planes for the U.S. Air Force.
First Solar , however, plunged to the bottom of the S&P 500 index after the solar panel maker forecast weaker sales this year and said it would cut prices to compensate for the end of solar subsidies in Europe. Still, at least six brokerages raised their price targets for the stock.
Among retail stocks, JC Penney also slumped after the department store retailer as investors worried about the company's ability to whether higher prices for fuel and clothing. Shares of Gap rose despite a boost in earnings and news it would increase its dividend and stock buyback program as investors focused on the retailer's weak earnings outlook. Susquehanna cut Gap to neutral from positive.
Freddie Mac, the government controlled mortgage company, posted a loss of $1.7 billion in the fourth quarterof last year and asked for $500 million in government aid, more than $100 million it sought in the third quarter.
Meanwhile, a regulatory filing late Tuesday showed that Freddie Mac Executive Vice President Don Bisenius may face charges from the Securities and Exchange Committee for allegedly breaking securities laws before the housing collapse.
The rebound in oil prices lent support to the dollar , which stabilized against a basket of currencies.
On the economic front, consumer sentiment index rose to its best level since January 2008, according to the Reuters/University of Michigan survey.
Earlier the market brushed off a weaker-than-expected report on the nation's Gross Domestic Product. The economy grew at a 2.8 percent pacein the fourth quarter, down from an initial estimate of an annualized rate of 3.2 percent, the Commerce Department reported Friday.
And Richmond Fed President Jeffrey Lacker told CNBC that the Fed needs to start winding down its monetary easing programsbefore inflation becomes a serious problem. Lacker said central bankers need to get ahead of the trend and start re-examining its programs now while the economy is in its initial recovery phase.
"Recovery has been well established, growth is going to pick up," said Lacker. "At this point in the business cycle we need to withdraw monetary policy stimulus at some point in order to prevent inflation from rising, and it's often at this stage that inflation picks up."
On Tap Next Week:
MONDAY: Personal income and spending, Chicago purchasing managers index, pending home sales, Dallas Fed survey, farm prices; Boston Fed president Rosengren speaks.
TUESDAY: Auto sales, ISM manufacturing index, construction spending; Fannie/Freddie reform hearing before House financial services committee; and Bernanke's semi-annual report on monetary policy to Congress.
WEDNESDAY: Mortgage applications, Challenger job-cut report, ADP employment report, oil inventories, Federal Reserve's Beige Book; Atlanta Fed President Lockhart speaks; earnings before-the-bell from BJ's, Costco and Staples.
THURSDAY: Chain store sales, ECB announcement, Monster employment index, jobless claims, productivity and costs, ISM non-manufacturing index, natural gas inventories, money supply; Minneapolis Fed President Kocherlakota speaks, Atlanta Fed President Lockhart speaks; earnings before-the-bell from Heinz, Kroger; earnings-after-the-bell from Novell.
FRIDAY: Non-farm payrolls report, factory orders; Federal Budget Deadline.
More From CNBC.com: