U.S. stocks gained on Tuesday as consumer confidence data bolstered views the economy's recovery is on track and results from Travelers Cos and Apple Inc strengthened the quarterly earnings picture.

Shares of Travelers led gains on the Dow after the property-casualty insurer posted a profit that beat Wall Street's estimate. The stock advanced 4 percent to $50.84.

Data shortly after the open showed consumer confidence rose for a third straight month in January to its highest level since September 2008, relieving some worries about individual spending. Sectors that benefit from an improved economic outlook were among top performers, including the S&P tech sector <.GSPT>, up 1.1 percent.

We had consumer confidence move the market up, and it's been on the run since then. We also had some earnings... That's been more positive than negative, said Stephen Carl, principal and head of U.S. Equity Trading at The Williams Capital Group LP in New York.

The market is trying to hang in there after being knocked down last week, he said. Stocks had their worst three-day slide in 10 months at the end of last week.

The Dow Jones industrial average <.DJI> was up 65.75 points, or 0.64 percent, at 10,262.61. The Standard & Poor's 500 Index <.SPX> was up 4.62 points, or 0.42 percent, at 1,101.40. The Nasdaq Composite Index <.IXIC> was up 12.47 points, or 0.56 percent, at 2,223.27.

Stocks opened lower on concerns about a Chinese government clampdown on bank lending. Banking sources said China's central bank told some banks to increase their reserve ratios by 0.5 percentage point to curb excessive lending.

iPhone maker Apple gained 4.1 percent to $211.46, a day after reporting profits and sales above Wall Street estimates.

Apple provided the biggest lift to the Nasdaq, followed by Microsoft Corp , which is scheduled to report later this week.

DuPont , which also reported results, was up 0.4 percent at $32.96, but Johnson & Johnson , which gave a conservative forecast, dipped 0.8 percent to $62.70.

(Editing by Kenneth Barry)