The Dow Jones industrial average closed about 117 points higher, after falling more than 70 points and rising 192.78 points in the open. The S&P 500 closed up nearly 0.8 percent after earlier falling into negative territory.
The Nasdaq composite outperformed to close up 1.03 percent, off session highs of a more than 1.5 percent rise but after posting eight-straight days of losses. The Nasdaq composite closed lower Monday to post its first eight-day losing streak since January 2008.
"The good news is, after the close in energy prices, we know it's not going to go any lower," said Art Hogan, chief market strategist at Wunderlich Securities.
Read MoreEnergy experts question oil's bottom
The oil settle, which usually comes around 2:30 p.m. ET, was delayed amid the heavy volatility of the session. Dow Jones reported crude settled down 97 cents at $30.44 a barrel.
Oil prices remained near their lowest in more than a decade as oversupply concerns persisted. In intraday trade, Brent futures hit a low of $30.34 a barrel and U.S. crude oil futures briefly fell more than 4 percent to below $30 a barrel.
WTI has settled lower every single day of the year so far, for a seven-day losing streak, its longest consecutive decline since a nine-day losing streak in July 2014.
Analysts at several major firms cut their 2016 oil forecasts this week, with Standard Chartered saying oil could fall as low as $10 per barrel.
"Whatever the number is, the logic behind it is the market has to reach a shocking level for oil producers of all (types) to respond," said John Kilduff, founding partner at Again Capital. His target is $18 and he expects oil to trade in a range between $14 and $48 this year.
Copper hit a fresh low going back to April 2009. The decline pressured Freeport-McMoRan, which closed down 4.6 percent, well above session lows. Freeport shares fell 20 percent Monday amid declines in copper and news Arch Coal filed for Chapter 11 bankruptcy protection, as part of a restructuring agreement reached with lenders who hold more than $4.5 billion of the coal mining company's debt.
"The Arch Coal bankruptcy reminds me that 0 is the ultimate number for these bankruptcies," Kilduff said.
In the close, the Nasdaq composite and Dow Jones industrial average remained 10 percent or more below their 52-week intraday highs, in correction territory. The S&P 500 closed within 10 percent of its 52-week high.
"Today is a relief rally on China's ability to stabilize their own markets and I believe China-inspired volatility will continue in 2016 because what they need to do is move to a freer market and they're having trouble letting go," said Doug Cote, chief market strategist at Voya Investment Management.
Overnight, the Chinese central bank set the yuan mid-point fix at 6.5628 against the dollar, similar to Monday's fix of 6.5626.
Read MoreChina opens new front in war on yuan speculators
"You can't both do reform and maintain a 6.5 percent growth rate at the same time. ... The feedback loop is slowing global growth. That's one of the implications of low oil," Cote said.
In November, China's President Xi Jinping said the country's economic growth rate will not be less than 6.5 percent in the five years to 2020, Reuters reported, citing the state-run Xinhua news agency.
Traders were watching to see whether Tuesday's early rally was sustainable. Weakening in China's currency and speculation of further devaluation helped pressure U.S. stocks to end the first trading week of the year down nearly six percent or more, their worst week since 2011.
"At the highest level, investors are starting to adjust to the uncertainty of a new regime of interest rates in the United States," said Omar Aguilar, chief investment officer, equities, at Charles Schwab Investment Management. "Then we have significant headwinds coming out of emerging markets."
Read More'Now you know': Why Fed feared a quarter-point hike
Stocks in Europe closed off session highs Tuesday, while Chinese stocks closed slightly higher after wavering between gains and losses on Tuesday, following a sharp plunge Monday.
"I get the sense where this market is one where ... the overarching concern is global macro, so rallies are seen more as selling opportunities," Hogan said.
BTIG Chief Technical Strategist Katie Stockton said in a morning note that the rally in the S&P futures Tuesday morning could be the beginning of an oversold bounce that might last one to two weeks.
"Unfortunately, the SPX would have to rally about 100 points by Friday in order to suggest a shakeout (read: false breakdown) has occurred," she said. "As it stands, breakdowns are abundant from a bottom-up perspective, so we think near-term strength is best viewed as an opportunity to take down exposure."
The November Job Openings and Labor Turnover Survey showed 5.431 million openings. The November quits rate was 2.0 percent, unchanged from the mildly upwardly revised October rate, according to StreetAccount.
Treasury yields held lower with the 2-year yield at 0.93 percent and the 10-year yield at 2.11 percent. On Tuesday, the 2-year yield touched 0.908 percent, its lowest in 4 weeks, and the 10-year yield touched a low of 2.08 percent, its lowest since late October.
The Treasury Department auctioned $24 billion of 3-year notes at a high yield of 1.174 percent, the lowest yield since October, according to Reuters.
The U.S. dollar traded about 0.3 percent higher against major world currencies, with the euro near $1.085 and the yen at 117.71 yen against the greenback.