Stocks rose slightly on Tuesday as upbeat quarterly results from bellwether companies, including Caterpillar Inc, overshadowed Federal Reserve Chairman Ben Bernanke's cautious outlook for the economy.

The Dow industrials <.DJI> held on to early gains as Caterpillar shares soared more than 10 percent to $40.62, following results and an upbeat outlook by the world's largest maker of mining and construction vehicles.

Bernanke said in testimony to a House of Representatives committee that job insecurity, together with declines in home values and tight credit, is likely to limit gains in consumer spending -- a key driver of the U.S. economy.

(Bernanke) sees what he calls 'tentative signs of stabilization,' but he remains very cautious about calling this a recovery, said Hugh Johnson, chief investment officer at Johnson Illington Advisors in Albany, New York.

The Dow Jones industrial average gained 56.23 points, or 0.64 percent, to 8,904.38. The Standard & Poor's 500 Index <.SPX> edged up 0.90 points, or 0.09 percent, to 952.03. The Nasdaq Composite Index <.IXIC> shed 4.37 points, or 0.23 percent, to 1,904.92.

The S&P 500 closed at an eight-month high on Monday, as the early stages of a healthier-than-expected second quarter earnings season lifted investors' hope about the economic recovery.

After the closing bell on Monday, chipmaker Texas Instruments Inc posted a stronger-than-expected second-quarter operating profit, but its stock slipped more than 3 percent to $22.90.

(Additional reporting by Chuck Mikolajczak)

(Editing by Padraic Cassidy)