U.S. stocks were mixed on Tuesday following a rally in commodity producers boosted the market to overcome downbeat data on housing and consumer sentiment.

The Dow Jones Industrial Average erased a 100-point tumble during earlier trading. Newmont Mining Co., Freeport-McMoRan Copper & Gold Inc., and Alcoa Inc. boosted the Standard & Poor's 500 Index to its largest three-day gain since November after metal prices increased.

The S&P 500 added 2.56 points, or 0.2 percent, to 1,352.44 while the Dow increased 18.56 , or 0.2 percent, to 12,530.08. The Nasdaq Composite Index rose 12.54, or 0.5 percent, to 2,339.29. Seven stocks gained for every three that declined on the New York Stock Exchange.

Consumer Confidence

The Conference Board's consumer confidence index slumped to 64.5, a five-year low after data showed retailers dropped the most among 24 industry groups in the S&P 500. The board's measure of expectations for the next six months dropped to 47.9, the lowest since 1973.

Meanwhile, the latest Case-Shiller data compiled by Standard & Poor's showed U.S. home prices fell 10.7 percent in January from a year earlier. The gauge has fallen for 13 consecutive months.

Mining companies gained as a drop in the dollar pushed gold higher while silver, aluminum and copper also rose. Freeport- McMoRan rose $3.58 to $92.34.

Newmont Mining Co., the world's second-largest gold producer, added $1.23 to $46.69. Alcoa Inc., the world's third-largest aluminum producer, increased 83 cents to $35.87 for the biggest gain in the Dow average.

Bank of America Corp., the second-biggest U.S. bank by assets, fell $1.44, or 3.39 percent, to $41.01. The companies stock was downgraded to sell from neutral at Merrill Lynch & Co.