S&P snaps 8-day rally, stocks retreat from highs ahead of Bernanke

Stocks closed lower Tuesday, with the S&P 500 breaking an 8-day rally, following a mixed batch of economic and earnings reports and as investors hesitated to jump in ahead of Fed Chairman Ben Bernanke's congressional testimony.

(Read More: After-hours buzz: Yahoo, CSX, Realogy & more)

S&P 500

The Dow Jones Industrial Average slid 32.41 points to finish at 15,451.85, dragged by by Coca-Cola and Walt Disney.

The S&P 500 erased 6.24 points to close at 1,676.26. And the Nasdaq dipped 8.99 points to end at 3,598.50. Both indexes snapped their 8-day win streak. The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, jumped above 14.

Most key S&P sectors finished in the red, led by energy and materials.

Dow component Coca-Cola slumped after the beverage giant posted weaker-than-expected sales, which it blamed on economic malaise and unusually cold and wet weather.

Also, Goldman Sachs was the latest participant in the parade of big U.S. financial institutions to report blowout profits. The company reported earnings per share of $3.70, well ahead of the $2.82 estimates. Revenue also easily beat expectations. Still, shares reversed its initial gains to finish lower.

(Read More: Enjoy it while itlasts: Bank earnings face trouble)

Johnson & Johnson posted quarterly earnings and revenue that topped expectations, thanks to strong sales of prescription drugs and medical devices, and lifted its full-year earnings forecast. But shares ended flat.

Yahoo and CSX are among notable companies scheduled to post earnings after the closing bell.

"We know earnings in the second quarter aren't going to be particularly good and we know GDP growth in the second quarter wasn't particularly good, but there's a fair bit of optimism built into the back half of the year and so from our standpoint, we're focused almost entirely on what companies had to say on the second half of the year and what that means for stock prices," said Dan Greenhaus, chief global strategist at BTIG.

Investors will be looking ahead to Fed Reserve Chairman Ben Bernanke's semi-annual testimony to Congress on Wednesday, from which they hope to garner further clues on the direction of monetary stimulus.

"In recent weeks the message that he's given is that we have seen signs of improvements in the U.S. economy and we're going to move towards tapering. Then he gives us the message that we got last week, so I think markets will be cautious ahead of Bernanke's testimony," said Robert Rennie, global head of currency strategy at Westpac.

Meanwhile, Kansas City Fed President Esther George said the central bank should begin to reduce its massive bond-buying program and bring it to a close "sometime in the first half of next year."

Dell declined after the tech company may delay by about a week a scheduled July 18 shareholder vote on a $24.4 billion buyout offer from founder Michael Dell and private equity firm Silver Lake, according to reports.

Onyx Pharmaceuticals gained after the biopharmaceutical company is expecting acquisition interest from nearly five parties including Amgen and Pfizer, according to reports.

Tesla, which joined the Nadsaq 100 index on Monday, suffered its worst one-day decline since January 2012 following a bearish note from Goldman Sachs.

On the economic front, homebuilder confidence jumped in July to its strongest level since January 2006, according to the National Association of Home Builders. The NAHB/Wells Fargo Housing Market index rose to 57 from a revised 51 in June. Analysts polled by Reuters had projected the index likely held at its originally reported June level of 52.

Most homebuilders including Beazer, KB Home and Toll Brothers turned higher following the report.

Consumer price index gained 0.5 percent in June thanks to a gain in gasoline prices. Economists polled by Reuters had expected consumer inflation to increase 0.3 percent last month. Excluding food and energy costs, the core reading edged up 0.2 percent.

And industrial production edged up 0.3 percent in June after an unchanged reading in May, according to the Federal Reserve. Economists polled by Reuters had expected a gain of 0.2 percent.

Elsewhere, Japan's benchmark index hit a new seven-week high and as earnings season picked up.

The Nikkei 225 hit its highest levels since May 24, and the yen weakened to the 100 handle against the U.S. dollar, after Japan's economics minister, Akira Amari, said the government will go ahead with a planned sales tax hike.

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

On Tap This Week:

WEDNESDAY: MBA mortgage applications, housing starts, Ben Bernanke speaks, oil inventories, Beige book; Earnings from Bank of America, Novartis, Abbott Labs, Bank of NY Mellon, Mattel, American Express, Ebay, IBM, Intel, Sandisk
THURSDAY: Jobless claims, Ben Bernanke speaks, Philadelphia Fed survey, leading indicators, natural gas inventories, Fed balance sheet/money supply, Dell special shareholder mtg; Earnings from BlackRock, Morgan Stanley, United Health, Verizon, Nokia, Google, Microsoft, AMD, Capital One, Chipotle
FRIDAY: G20 in Russia; Earnings from GE, Schlumberger, Vodafond, Honeywell

What's Trending on CNBC.com: