NEW YORK – Stocks rose for the third straight day Friday, capping the best week for the Dow Jones industrial average since July.

The government said the economy grew at a 3.1 percent annual rate in the fourth quarter of 2010. That’s slightly better than economists expected and higher than the estimate made last month.

Technology shares rose after business software giant Oracle Corp. reported a 78 percent jump in income late Thursday. The database software maker credited new software license sales and the benefit of three full months of revenue from Sun Microsystems, a company it acquired last year.

The Dow rose 50.03 points, or 0.4 percent, to close at 12,220.59. It gained 362 points for the week, the most since a 512-point jump during the week ending July 9.

The S&P 500 rose 4.14, or 0.3 percent, to 1,313.80. The Nasdaq rose 6.64 points, or 0.2 percent, to 2,743.06.

All three stock indexes gained more than 2 percent for the week, helping them erase losses after the March 11 earthquake that hit Japan. The week started with a 178.01-point jump for the Dow after AT&T Inc. agreed to buy T-Mobile USA for $39 billion. That raised hopes for more buyouts. Better economic reports and stronger earnings followed, driving more gains.

Investors were able to set aside a long list of worries including high oil prices, problems with Japan’s nuclear reactors and fresh developments in Europe’s debt crisis.

Portugal looked likely to need bailout funds from the European Union after lawmakers rejected a plan to cut the country’s debts. But Portugal’s debt troubles aren’t rattling U.S. stock investors because there’s an assumption that the European Union will come to the country’s aid, said Jack Ablin, chief investment officer of Harris Private Bank in Chicago.