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.