U.S. stocks rose on Friday on buying by investors holding short positions who locked in profits after a revenue warning from a major technology company and downbeat remarks by Federal Reserve Chairman Ben Bernanke.

Major indices fell sharply after Bernanke's comments and the warning by technology bellwether Intel Corp .

The decline took the S&P 500 index to 1,040, a key technical level that has consistently brought in buyers in the past year.

The testing of 1,040 and a better-than-expected reading on second-quarter gross domestic product triggered buying by short sellers, who covered their positions that profited from recent weakness in housing and manufacturing earlier in the week.

We're sitting on important support and in thin markets you don't want to be leaning too far in one direction coming into a very low volume week, said Richard Ross, global technical strategist at Auerbach Grayson in New York.

If you were short the market throughout this month, you made a nice profit, you want to lock that in.

Despite Intel's warning, its shares were up 1.5 percent at $18.45 after falling earlier in the day to their lowest level since July 2009. The chipmaker's shares were down 15 percent in the past five weeks.

Even though the news is bad, the bad news is already in the valuation. Obviously business isn't going great there, but the stock is so cheap this doesn't matter, said Stephen Massocca, managing director at Wedbush Morgan in San Francisco.

Shares in Intel were halted twice, once pending news and once after the stock triggered a circuit breaker.

The Dow Jones industrial average <.DJI> rose 139.03 points, or 1.39 percent, to 10,124.84. The Standard & Poor's 500 Index <.SPX> gained 14.47 points, or 1.38 percent, to 1,061.69. The Nasdaq Composite Index <.IXIC> climbed 29.55 points, or 1.39 percent, to 2,148.24.

Nonetheless, the Dow and S&P 500 were on track for their third week of declines in a row.

Bernanke told central bankers at a conference in Jackson Hole, Wyoming, the recovery has weakened more than expected and the central bank was ready to take further steps if needed to spur the recovery.

The stock market started on a positive note after economic growth was revised down in the second quarter, but the reading was better than expected. The debate over whether the economic recovery has hit a soft patch or is headed for a double-dip recession has plagued the market.

Shares of 3PAR Inc

surged 24.9 percent to $32.50 after Hewlett-Packard Co again raised its buyout offer for the data storage company, leapfrogging a bid from Dell Inc . HP, a Dow component, fell 1 percent to $37.83, while Dell rose 2.8 percent to $12.08.

(Additional reporting by Rodrigo Campos and Chuck Mikolajczak; Editing by Kenneth Barry)