Oil prices were steady at $97 after soaring 8 percent in the past week. Oil prices had been rising, sending stocks lower, as concerns mounted that the uprising in Libya would curtail oil production.
Those concerns eased late Thursday after the International Energy Agency said the impact was far less than analysts had estimated and that any shortfall could be easily made up by tapping oil reserves in other countries.
Boeing Co. rose 2.3 percent. The Air Force awarded Boeing a $35 billion contract Thursday, one of the largest made by the military, for nearly 200 airborne refueling tankers.
DreamWorks Animation SKG Inc. fell 3 percent after the entertainment company reported revenue and adjusted earnings that were far below what analysts were expecting. Poor box office results from the Will Ferrell movie "Megamind" were partly to blame.
The Dow Jones industrial average rose 45 points, or 0.4 percent, to 12,113.
The Standard & Poor's 500 index rose 9, or 0.7 percent, to 1,315. The Nasdaq rose 31, or 1.1 percent, to 2,768.
All three indexes are on track for a weekly loss, largely a result of the fighting in Libya.
Libya is Africa's largest producer of oil but only ranks 15th among the world's oil exporters. Traders have been concerned that fighting could not only threaten Libya's oil production but also spread to other countries in the region, such as Saudi Arabia, the world's largest exporter.
Higher oil prices also weigh on the U.S. economy by increasing the costs of moving goods and filling up gas tanks. A sustained $10 increase in the price of oil translates into a 0.2 percent cut in economic growth over 12 months, according to a recent estimate by economists at Goldman Sachs.
Treasurys inched up Friday on reports the economy grew more slowly than first thought in the last three months of 2010.
The Commerce Department said the economy expanded at an annual rate of 2.8 percent in the October-December quarter. That's weaker than the previous estimate of 3.2 percent. In an attempt to close budget gaps, state and local governments have cut spending much more deeply than previously thought.
Despite this week's slide, the S&P 500 is still up 2.3 percent in February and 4.6 percent for the year. Stronger earnings from a wide range of companies, including Archer Daniels Midland Co. and Dell Inc., have helped drive stocks higher.