(AP) -- 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 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, recovering after a slump Monday. 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 to get a boost from the pickup in energy prices.
Shares in Consol gained 37 cents, or 4.7 percent, to $8.24, while Chesapeake jumped 51 cents, or 12.5 percent, to $4.58.
"Lately the markets have been taking their cue from the movement in commodity prices, and in particular, oil," said Cronk.
In other energy trading in New York, wholesale gasoline rose 4.3 cents, or 3.5 percent, to $1.276 a gallon, heating oil rose 3.9 cents, or 3.6 percent, to $1.23 a gallon and natural gas jumped 14.4 cents, or 6.5 percent, 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.
Bond prices fell. The yield on the 10-year Treasury note rose to 2.31 percent from 2.23 percent late Monday. The dollar was slightly higher at 120.46 yen, up from 120.34 on Monday. The euro slipped to $1.0934 from $1.0975.
Among other stocks making big moves Tuesday:
-- Pep Boys surged 8.8 percent after the auto parts and services retailer received another offer from activist investor Carl Icahn, putting the deal in the neighborhood of $1 billion. Shares in Pep Boys have been ratcheting steadily higher over the past two months as a takeover bid from Japanese tiremaker Bridgestone turned into a fight for control with Icahn. The stock added $1.53 to $18.94.