A late wave of buying left the stock market higher on Tuesday, led by gains in technology and health care. Investors also had their eye on corporate earnings, which are just starting to trickle out.
The Dow average rose 117 points, or 0.7 percent, to 16,516. It wavered between gains and losses much of the day before rising fairly steadily after 2 p.m. Eastern.
The Standard & Poor's 500 index climbed 15 points, or 0.8 percent, to 1,938. The Nasdaq composite rose 47 points, or 1 percent, to 4,685.
Tuesday's increase was the first this year for the Nasdaq composite index, which is heavily weighted with technology companies.
Energy companies lagged the market as the price of crude oil fell to new 12-year lows.
"You're seeing very oversold conditions," said Phil Blancato, CEO of Ladenburg Thalmann Asset Management. "People here are basically buying the dip."
Deepening fears about a protracted slowdown in China's economy coupled with worries about Beijing's ability to manage its financial markets have kept investors on edge after sharp losses last week. A steep downturn in crude oil prices has also weighed on the market.
A day after slumping 5.3 percent, the price of U.S. crude oil briefly dipped below $30 a barrel before climbing back above that threshold before the close. Brent crude, a benchmark for international oils, fell $1.18, or 3.7 percent, to $30.70 a barrel in London.
Energy and mining companies were trading lower as oil prices continued to decline. Freeport-McMoRan (FCX) lost 20 cents, or 4.5 percent, to $4.11. Consol Energy (CNX) shed 30 cents, or 4.3 percent, to $6.70. Chesapeake Energy (CHK) fell 12 cents, or 2.9 percent, to $4.05.
European markets moved higher. Germany's DAX was up 2 percent, while the CAC-40 in France rose 1.9 percent. The FTSE 100 index of leading British shares was up 1.2 percent.
In Asia, China's Shanghai composite closed 0.2 percent higher, recovering some of its losses from the day before. Japan's Nikkei 225 fell 2.7 percent. Hong Kong's Hang Seng shed 0.9 percent, while South Korea's Kospi dropped 0.2 percent.
Bond prices rose. The yield on the 10-year Treasury note fell to 2.11 percent from 2.17 percent late Monday. The euro fell to $1.0825 from $1.0871 a day earlier, and the dollar rose to 117.78 yen from 117.53 yen.