Stocks End Flat; Materials Slide, Vix Jumps

Stocks erased most of their gains in the final hour of trading to finish nearly flat Tuesday, as earlier enthusiasm over the encouraging retail sales report and better-than-expected economic news from the euro zone faded.

"This is a market that's up on eggshells. People I talk to are still very nervous," said Alan Valdes, director of floor operations at DME Securities.

The Going Gets Tough...


The Dow Jones Industrial Average eked out a gain of 2.71 points, or 0.02 percent, to finish at 13,172.14. Alcoa and H-P dragged on the blue-chip index, while Home Depot rallied.

The S&P 500 slipped 0.18 points, or 0.01 percent, to end at 1,403.93. The Nasdaq fell 5.54 points, or 0.18 percent, to close at 3,016.98.

The CBOE Volatility Index, widely considered the best gauge of fear in the market, jumped near 15, rebounding from a five-year low in the previous session. 

Most key S&P sectors closed lower, led by materials and techs, while consumer staples eked out a gain.

"The U.S. economy is doing better than many foreign economies," wrote Gary Thayer, chief macro strategist at Wells Fargo Advisors. "As a result, it is likely that revised GDP numbers coming out later this month could show the U.S. economy did not slow down as much this past spring as many investors feared...then investor sentiment could improve even more."

On the economic front, July retail sales , according to the Commerce Department. And producer prices gained at the fastest pace in five months in July, according to the Labor Department.

Also, business inventories to $1.58 trillion in June, according to the Commerce Department, in line with estimates.

In Europe, second-quarter GDP reports from France and Germany came in above forecasts, easing concerns about the euro zone's two biggest economies, though the region as a whole contracted over the period, maintaining support for the case for ECB action. . (Read More: The Secret to Germany's Economic Strength)

“If [ECB President Mario Draghi] takes the disaster scenario off the table for the euro, investors can just look at the economic data—jobs report was better, retail sales were good, corporate earnings are still positive…we can move ahead,” said John Fox, co-manager of the FAM Value Fund. (Related: Surprise! Europe’s Next Hot Spot Not Where You Think)

Among earnings, Home Depot climbed after the home-improvement retailer topped Wall Street's profit estimates and . At least two brokerages raised their price targets on the firm.

Groupon tanked more than 25 percent after the daily-deals site missed sales expectations and handed in a cautious earnings outlook, due to Europe's weak economy and currency fluctuations. Shares have already plunged nearly 70 percent since the company's IPO last November. At least 10 brokerages slashed their price targets on the firm. (Watch: Groupon—A Deal or Disaster?)

Michael Kors soared after the upscale apparel retailer posted better-than-expected earnings and raised its full-year earnings forecast.

TJX raised its full-year earnings forecast on a rise in its quarterly revenue, thanks to shoppers seeing discounted designer products.

Department-store chain Saks posted a narrower-than-expected quarterly loss and maintained its revenue forecast for the second half of the fiscal year.

—By CNBC’s JeeYeon Park (Follow JeeYeon on Twitter: @JeeYeonParkCNBC)

Coming Up This Week:

WEDNESDAY: Weekly mortgage apps, CPI, Empire state mfg survey, Treasury int'l capital, industrial production housing market index, oil inventories, Fed's Kocherlakota speaks, credit card default rates reported, Facebook lock-up expiration, Forest Labs shareholders mtg; Earnings from Deere, Target, Cisco, Applied Materials, Limited Brands
THURSDAY: Housing starts, jobless claims, Philadelphia Fed survey, e-commerce retail sales, Fed's Kocherlakota speaks; Earnings from Wal-Mart, Dollar Tree, Sears, Ross Stores, Aeropostale, Gap
FRIDAY: Consumer sentiment, leading indicators; Earnings from Ann, JM Smuckers, Foot Locker

More From CNBC.com: