The Dow and S&P indexes rose on Tuesday as earnings at BP Plc lifted energy shares, but results at Chinese Internet search giant Baidu.com and weaker-than expected consumer confidence data pushed the Nasdaq lower.

BP reported third-quarter earnings that beat expectations, helped by cost cuts, sending the stock up 4.6 percent to $58.04 on the New York Stock Exchange.

The results lifted other energy companies, with Dow components Exxon Mobil Corp up 2 percent to $74.72 and Chevron Corp adding 2.1 percent to $77.02.

There is definitely a gathering bullishness around energy at large, which is helping support things, said Matt Kaufler, portfolio manager and equity analyst at Clover Capital Management in Rochester, New York.

If you believe the worst of the contraction is behind us, you're going to see oil prices continuing to rise.

December crude futures were up 1 percent to $79.44 per barrel.

The Conference Board's index of consumer confidence fell to 47.7 in October, weaker than the consensus expectation of a reading of 53.1. Confidence was pressured on growing concerns job market conditions would worsen in the near term.

The S&P consumer discretionary sector <.GSPD> was the biggest percentage loser among S&P sectors, down 1 percent.

The Dow Jones industrial average <.DJI> added 56.23 points, or 0.57 percent, to 9,924.64. The Standard & Poor's 500 Index <.SPX> rose 2.14 points, or 0.20 percent, to 1,069.09. The Nasdaq Composite Index <.IXIC> lost 7.67 points, or 0.36 percent, to 2,133.76.

The Nasdaq was pressured by the consumer confidence data and after Baidu reported quarterly revenue that missed expectations. Baidu said its fourth-quarter sales would miss expectations by more than 10 percent.

U.S.-listed shares of the company sank 13 percent to $378.47.

There was some positive news in the technology sector, after International Business Machines Corp's board approved an additional $5 billion in stock repurchases. Shares of the Dow component rose 1.2 percent to $121.57.

Other data on Tuesday showed home prices rose for the fourth-straight month in August.

The Standard & Poor's/Case-Shiller composite index of home prices in 20 metropolitan areas rose 1.2 percent in August from July, above the estimate of a 0.7 percent rise from a Reuters poll.

(Editing by Padraic Cassidy)