Stocks finished in positive territory Wednesday, reversing two-straight sessions of losses, as the energy sector jumped on rising oil prices amid speculation of a U.S.-led military strike on Syria.
Fears and uncertainty over Syria propelled oil prices to its highest level in nearly two years, while safe haven gold spiked to hit a 3-1/2 month peak. Energy company Marathon Oil led the S&P 500 gainers. Hess and BP also traded higher.
(Read more: Gartman's trade of the moment on the Syrian crisis)
"The market was somewhat impervious to the geopolitical risk that was out there and now it's come home to roost I think you want to watch both oil and gold," said Art Cashin, director of floor operations at UBS Financial Services. "We're playing a game of headline roulette here…you really don't know. The difficulty is that once events begin to take place, they can accelerate and that becomes a problem."
The Dow Jones Industrial Average, which had slumped 170 points on Tuesday, closed 48 points higher, led by Hewlett-Packard and Chevron.
The S&P 500 and the Nasdaq also closed higher after logging their worst day in two months on Tuesday. The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, slid below 17.
Among key S&P sectors, energy rallied, while interest rate-sensitive areas including consumer staples and telecoms dipped.
"You've got to be a little nervous here—the interest-sensitive sectors of the economy are showing signs of weakness," said Ethan Harris, co-head of global economic research at Bank of America/Merrill Lynch. "I think a fair reading of the data is not that things are collapsing, but we're still stuck in the mid in this 2-percent economy."
Major averages have stumbled in the last two days amid escalating concerns over Syria. The United States and its allies geared up for a probable military strike against Syria in response to a chemical gas attack that killed hundreds of civilians in a rebel-held suburb of Damascus.
Senior U.S. officials told NBC News the U.S. could launch missile strikes on Syria "within days." President Barack Obama and his officials have conducted a flurry of international consultations this week on how to respond to a alleged chemical weapons attack by Syria on its own citizens.
(Read more: 'Broken market'? Whythere's more trouble ahead)
Senator John McCain told CNBC the crisis in Syria is turning into a regional conflict with the potential for major economic consequences.
Worries over Syria coupled with the recent string of tepid economic reports have raised questions as to whether the Federal Reserve will really start dialing back its stimulus policies of asset purchases at next month's meeting.
"I think that the tapering case has been weakening pretty fast in the recent weeks," said Harris. "I think you can argue for tapering on the grounds that it's only a technical adjustment...but the fundamental case for a Fed exit is very weak at this point."
On the economic front, pending home sales declined 1.3 percent in July, according to the National Association of Realtors. And weekly mortgage applications fell for a third-straight week as average rates hit their highest level in 2013, though demand for purchase loans increased, according to the Mortgage Bankers Association.
Treasury prices extended their losses after the government auctioned $35 billion in five-year notes at a high yield of 1.624 percent. The bid-to-cover ratio, an indicator of demand, was 2.38, versus a recent average of 2.74.