Technology and health-care companies led a broad rally in U.S. stocks Tuesday that pulled the Standard & Poor's 500 index back into the black for the year.
The gains erased the market's losses over the previous two days, when worries over falling oil and other commodities prices dragged down stocks. That trend snapped on Tuesday as the price of U.S. crude oil rebounded with a 2.9 percent gain.
Investors also drew encouragement from better-than-expected data on consumer confidence and housing.
"Both of those set us up nicely on a low-volume day to be more positive than negative," said Darrell Cronk, president of Wells Fargo Investment Institute.
The Dow Jones industrial average rose 192.71 points, or 1.1 percent, to 17,720.98. The S&P 500 index gained 21.86 points, or 1.1 percent, to 2,078.36. The Nasdaq composite added 66.95 points, or 1.3 percent, to 5,107.94.
The S&P 500 index, considered a benchmark for the broader stock market, is now on course to end 2015 with a gain of about 1 percent. The Nasdaq is up nearly 8 percent for the year, while the Dow is down 0.6 percent.
In Europe, Germany's DAX rose 1.9 percent, while France's CAC 40 gained 1.8 percent. Britain's FTSE 100 rose 1 percent. Several markets in Asia notched small gains.
The U.S. rally accelerated as investors got a look at the latest batch of U.S. economic data.
The Conference Board said its consumer confidence index increased from the previous month, reflecting positive views on the economy and job market.
Separately, a key gauge of home values indicated that U.S. home prices climbed 5.5 percent in October from a year earlier. Home values have climbed at a roughly 5 percent pace during much of 2015 as strong hiring bolstered the real estate market, which is still recovering from a bust that triggered a recession eight years ago.
Traders also welcomed a break in the decline in crude oil prices. Benchmark U.S. crude rose $1.06, or 2.9 percent, to close at $37.87 a barrel on the New York Mercantile Exchange. Brent crude, which is used to price international oils, gained $1.17, or 3.2 percent, to close at $37.79 a barrel in London.
Consol Energy and Chesapeake Energy were among the companies boosted by a pickup in energy prices. Shares in Consol gained 37 cents to $8.24, while Chesapeake jumped 51 cents to $4.58.
In other energy trading in New York, wholesale gasoline rose 4.3 cents to $1.276 a gallon, heating oil rose 3.9 cents to $1.23 a gallon and natural gas jumped 14.4 cents to $2.372 per 1,000 cubic feet.
Precious and industrial metals prices ended mixed. Gold slipped 30 cents to $1,068 an ounce, silver rose 4 cents to $13.93 an ounce, and copper gained 6 cents to $2.14 a pound.