Traders work on the floor of the New York Stock Exchange, July 28, 2015. Reuters/Brendan McDermid

U.S. stocks rallied Tuesday, with the Dow Jones Industrial Average leaping nearly 200 points, shaking off global concerns after China's stock market suffered its greatest single-day loss since 2007 a day earlier. All 10 Standard & Poor's 500 sectors closed higher, led by a 3 percent gain from the energy sector, which also helped boost the industrials and materials sectors around 2 percent.

The Dow (INDEXDJX:.DJI) soared 189.68 points, or 1.09 percent, to close at 17,630.27. The S&P 500 index (INDEXSP:.INX) added 25.61 points, or 1.24 percent, to end at 2,093.25. And the Nasdaq composite (INDEXNASDAQ:.IXIC) gained 49.43 points, or 0.98 percent, to finish at 5,089.21.

Nearly all 30 stocks in the Dow closed higher as energy led Tuesday, with Exxon Mobil Corporation (NYSE:XOM) and Chevron Corporation (NYSE:CVX) gaining, 4 percent and 3.6 percent, respectively. Chemical maker DuPont Co. (NYSE:DD) and software company Microsoft Corporation (NASDAQ:MSFT) were the only decliners in the index, closing down 1.5 percent and 0.02 percent, respectively.

Dow Jones Industrial Average (Closing) | FindTheData

Energy stocks received a boost when oil prices turned higher after bouncing back from nearly six-month lows. The rally was helped as investors forecast a drop in U.S. crude stockpiles for last week. The U.S. Energy Information Administration will release its weekly data on commercial crude oil inventories at 10:30 a.m. EDT Wednesday.

Oil has been weighed down recently on renewed fears of oversupply as Iran and global powers reached a nuclear deal. The agreement would remove Western sanctions against Tehran and investors fear it could affect a global oil market already facing oversupply.

"Oversupply and the looming return of exports from Iran are undoubtedly weighing on oil prices," Tom Pugh, a commodities economist at Capital Economics, said in a research note Tuesday. "However, prices are likely to continue to be more influenced by sentiment toward commodities in general and by developments in China in particular."

WTI Crude Oil Spot Price | FindTheData

Investor sentiment toward industrial commodities has soured further over the past week, and the main source of concern has been a renewed slump in Chinese stock prices over the last few days, sparking fears about China's economy, which has dragged the prices of industrial commodities, especially oil, down even further.

But Pugh expects China to avoid a hard landing as growth in the world's second-largest economy actually picked up toward the end of the second quarter. "The authorities still have plenty of tools to boost support to the economy, and indeed the equity market, if recent turbulence shows signs of getting out of hand," Pugh said.

West Texas Intermediate (WTI) crude, the benchmark for U.S. oil prices, added 1.24 percent to close at $47.98 per gallon barrel for September delivery on the New York Mercantile Exchange. On the London ICE Futures Exchange, Brent crude, the global benchmark for oil prices, fell 20 cents to $53.30.

Economists are turning their attention to the U.S. Federal Reserve’s two-day policy meeting this week. The Federal Open Market Committee will issue a statement from the central bank at 2 p.m. EDT Wednesday that could shed more light on the central bank’s plan to lift interest rates sometime this year. Those rates have hovered at historic lows since the financial crisis of 2007-09. Most economists anticipate the Fed will remain on course to lift rates in September.