U.S. stocks rose on Thursday as investors snapped up beaten-down technology and commodity shares, while a positive broker comment on Goldman Sachs boosted the financial sector.

Investors bought shares of technology and commodity-related companies as they moved out of defensive shares, including healthcare and consumer staples, which had led the market higher recently due to uncertainty about the economy.

It's a reversal of what we've seen the last couple days. It's a little bit of sector rotation evening things up, said Paul Nolte, director of investments at Hinsdale Associates in Hinsdale, Illinois.

Within the tech sector, KLA Tencor Corp shot up 5.1 percent to $26.43 after the chipmaker was upgraded to overweight by Barclays. The PHLX semiconductor index <.SOXX> gained 3.5 percent.

Nolte said the comment on Goldman Sachs Group Inc added a positive tone to the market.

Goldman rose 4.3 percent to $144.46 after its stock was upgraded to buy, and earnings estimates were raised by Banc of America Securities-Merrill Lynch. The S&P financial sector <.GSPF> led the S&P 500 with a gain of 2.2 percent.

The Dow Jones industrial average <.DJI> was up 36.12 points, or 0.44 percent, at 8,214.53. The Standard & Poor's 500 Index <.SPX> rose 7.68 points, or 0.87 percent, at 887.24. The Nasdaq Composite Index <.IXIC> added 15.36 points, or 0.88 percent, at 1,762.53.

Stocks briefly pared gains following results from a Treasury bond auction that capped a week of strong demand for the growing government debt.

Energy shares rose, with the S&P energy index <.GSPE> up 1.7 percent as crude oil futures edged up. Oil giant Chevron Corp was up 1 percent to $63.34. The oil giant is expected to report interim quarterly results later Thursday.

Shares of healthcare companies were the biggest drag, with Dow component Merck & Co Inc down 3.3 percent to $27.13 on speculation its Zetia cholesterol drug fared poorly in a clinical trial comparing it to a drug from Abbott Laboratories.

(Additional reporting by Leah Schnurr; editing by Jeffrey Benkoe)