U.S. stocks gained on Tuesday as strong U.S. consumer confidence data outweighed initial disappointment caused by a disappointing report on durable goods orders.

Stocks opened the session flat after data showed orders for long-lasting goods had the biggest fall in three years and dented optimism about the pace of the domestic recovery.

But stocks managed to gain some traction to the upside after the Conference Board said consumer confidence in the world's largest economy jumped to a one-year high in February. The reading carries weight as consumer spending accounts for more than two-thirds of U.S. economic activity.

The S&P retail index <.RLX> gained 1.4 percent.

They are focusing on the positive and eliminating the negative reports, which I am very interested in because durable goods was tough - it was a big miss, said Ken Polcari, managing director of ICAP Equities in New York.

So there is a lot going on, but the fact is, those couple of reports that came out today are clearly conflicted, clearly mixed. So once again, we are kind of stuck in the middle.

The Dow Jones industrial average <.DJI> gained 31.67 points, or 0.24 percent, to 13,013.18. The Standard & Poor's 500 Index <.SPX> rose 4.75 points, or 0.35 percent, to 1,372.34. The Nasdaq Composite Index <.IXIC> added 21.14 points, or 0.71 percent, to 2,987.30.

The S&P 500 ticked above 1,370, but some analysts have cautioned the rally this year has occurred on light volume, leaving the market susceptible to a pullback. Still, a close above 1,370 could invite momentum buying as money managers chase performance.

Daily volume on the New York Stock Exchange, NYSE Amex and Nasdaq has averaged 6.89 billion shares so far in February. The average in February 2011 was 7.81 billion.

Technology shares ranked among the best performers, with Micron Technology Inc up 6.8 percent at $9.14 after Intel Corp said it will sell its stake in two wafer factories to Micron and buy chips from the company.

Intel advanced 1.3 percent to $27.23. The PHLX semiconductor index <.SOX> rose 1.9 percent.

Retailers got a lift from the earnings of Office Depot Inc , which surged 16.2 percent to $3.51, and AutoZone Inc , which rose 2.5 percent to $375.13.

With earnings season drawing to a close, 472 of the S&P 500 components have reported results through Tuesday morning. About 63 percent beat analysts' expectations, below the average 70 percent beat rate in the last four quarters, but slightly above the average of 62 percent since 1994.

Europe's banks were expected to take in another half trillion euros in cheap three-year loans offered by the ECB on Wednesday in a bid to inject liquidity into the fragile banking system.

Oil fell for a second straight session, with Brent crude futures off 1 percent at $122.85 and U.S. crude down 0.3 percent at $108.22, halting a surge that has threatened to hurt the global economy. Equity investors remained wary over persistent supply worries from the Middle East, but improving economic news has played continue to play a key role in driving the U.S. equities market.

(Reporting By Chuck Mikolajczak; Editing by Jan Paschal)