The rise in stocks came a day after the Dow and the S&P posted their worst sessions since August. Stocks pulled back sharply amid rising tension between North Korea and the West.
"As far as North Korea is concerned, the template has been it intensifies and then it levels off. When it levels off, it becomes a buying opportunity," said Quincy Krosby, chief market strategist at Prudential Financial. "But the issue with North Korea is not going away."
North Korea tested a hydrogen bomb on Sunday. The test, which was condemned by the international community, led investors to increase their exposure to traditional safe havens like gold. U.S. gold futures for December delivery settled lower at $1,339 per ounce, near a one-year high.
Wall Street also paid attention to U.S. interest rates after the benchmark 10-year yield hit its lowest level of the year in the previous session. The move lower came after Federal Reserve Gov. Lael Brainard said the central bank should be cautious in raising rates while inflation remained weak.
Brainard's comment came at a time when investors are assessing the possibility of another Fed rate hike later this year. Market expectations for a December rate hike are just 36 percent, according to the CME Group's FedWatch tool.
Investors also looked ahead to the conclusion of the European Central Bank's latest monetary policy meeting, which is set for Thursday.
Fed Chair Janet Yellen and ECB President Mario Draghi "seem committed to tightening, both quantitatively and via interest rates, but monetary conditions will remain fairly stimulative so long as inflation does not become a problem," said Charles Dumas, chief economist at TS Lombard, in a note to clients.
In other central bank news, Fed Vice Chairman Stanley Fischer said Wednesday he would be stepping down from his post effective Oct. 13.
In economic news, international trade numbers showed the U.S. trade deficit for July came in at $43.7 billion, below the expected $44.7 billion. Other data released include the IHS Markit PMI for August, which hit 56.0 and the ISM non-manufacturing index, which was in line with expectations.
The Federal Reserve's Beige Book was also released Wednesday. The report found that the U.S. economy expanded at a modest to moderate pace in July through mid-August but signs of an acceleration in inflation remained slight.
"Prices rose modestly overall across the country," the central bank said in its Beige Book report of the economy, compiled from anecdotal evidence derived from business contacts nationwide.
Policymakers have raised interest rates twice this year but the prospect of a third in 2017 appears increasingly uncertain against a backdrop of weak price pressures.