Wall Street erased initial gains and moved higher on Tuesday as a string of economic data helped relieve investor anxiety about the strength of the economic recovery.

U.S. consumer confidence rose modestly in August, lifted by a mild improvement in the short-term outlook, but business activity in the U.S. Midwest registered a slowdown in August, growing a bit less than economists expected, according to a private report released on Tuesday.

Confidence was a little better. That PMI coming almost in line gave us a little bit of relief too, said Kevin Kruszenski, head of listed trading at KeyBanc Capital Markets in Cleveland.

Between what we saw with new home sales, construction spending, the Philly Fed being weak, that sort of pointed to a lower PMI, at least sentiment appeared that way.

Earlier, the Standard & Poor's/Case Shiller home price indexes showed prices of U.S. single-family homes rose more than expected in June and was up in the second quarter, reflecting the lingering boost from homebuyer tax credits that ended in April.

The Philly Fed, a reading of manufacturing activity in the Mid-Atlantic region and U.S. housing starts for July were both datapoints that came in below expectations during the month of August.

The Dow Jones industrial average <.DJI> gained 27.32 points, or 0.27 percent, to 10,037.05. The Standard & Poor's 500 Index <.SPX> rose 2.31 points, or 0.22 percent, to 1,051.23. The Nasdaq Composite Index <.IXIC> added 3.73 points, or 0.18 percent, to 2,123.70.

Before stocks rebounded, the S&P 500 neared 1,040, a key support level that has been successfully defended twice last week. Even with Tuesday's advance, the benchmark index was on track to close out August with its third loss in the last four months.

Monsanto Co dropped 5.2 percent to $53 after the seeds maker forecast full-year 2010 earnings below expectations.

Deere & Co rose 0.7 percent to $63.45 after a deal to sell its wind power business to electric utility Exelon Corp for about $860 million. Exelon was down 0.5 pct to $40.31.

Later Tuesday, the Federal Reserve releases minutes from its policy meeting on August 10, when it endorsed a more dovish monetary posture, citing a willingness to reinvest in monetary accommodation. Last week, Fed Chairman Ben Bernanke said in a speech the recovery had weakened more than expected.

(Reporting by Chuck Mikolajczak; editing by Jeffrey Benkoe)