U.S. stocks closed higher Wednesday, the last full trading day of the week, led by recovery in oil prices and commodities-related sectors.
The S&P 500 closed 1.2 percent higher to end in positive territory for the year so far, joining the Nasdaq composite with its year-to-date 6.5 percent gain. The Dow Jones industrial average remains more than 1 percent lower for 2015.
Energy rallied about 4.2 percent to lead all 10 S&P 500 sectors higher. The sector is still the worst performer in the S&P for the year, down more than 20 percent.
The rally is "commodity-based. ... It's buying the laggards," said Peter Boockvar, chief market analyst at The Lindsey Group.
"We've been seeing headlines from China in the last couple of weeks on production cuts. ... I think the production cuts in China are real and (commodities will) bottom a little bit," he said.
U.S. crude oil futures settled up $1.36, or 3.76 percent, at $37.50 a barrel, above Brent for the second day in a row. Brent settled at $37.41 a barrel. Copper and iron also gained.
Freeport-McMoRan closed up 16 percent to lead materials, the second-best advancer in the S&P 500. Year-to-date, the sector is down nearly 9 percent, while Freeport is down more than 65 percent for the year so far.
"Reform announcements can generate hope in the market, but the key is implementation and there are plenty of examples where China has failed at the successful implementation of reform goals in 2015 (renminbi devaluation, stock market intervention, etc.)," Jeffrey Kleintop, chief global investment strategist at Charles Schwab, said in an email.
Oil prices recovered slightly from recently touched multi-year lows, with U.S. crude briefly surging more than 4 percent.
Crude traded at its highest level in more than a week after official inventory data from the EIA showed a decline of 5.9 million barrels, following a surprise dip in U.S. inventories from the American Petroleum Institute late Tuesday. The U.S. oil rig count showed a decline of 3, according afternoon data from Baker Hughes.
The major U.S. averages posted three-straight days of days of gains, on track for a weekly return of more than 2.5 percent each, their best since late November. The gains come after a sharp sell-off at the end of last week.
"It's been reasonably strong (for stocks) all week. I don't know if it's because of any phenomenal economic statistics, although it's comforting the U.S. consumer is reasonably strong," said Ben Pace, chief investment officer at HPM Partners.
There's a "natural tendency for a year-end rally. I hate to just attribute it to that," he said, also noting a "calming of the fears in the high-yield junk bond market."
Both the SPDR Barclays High Yield Bond ETF (JNK) and iShares iBoxx USD High Yield Corporate Bond ETF (HYG) ended about half a percent higher Wednesday but are down about 10 percent or more for the year so far.
"Fundamentals did not really change that much. It's just technical," said Aaron Clark, portfolio manager at GW&K Investment Management. He attributed a "great deal" of the gains to short-covering.
"I think it's oil and the fact that confidence remains high are behind the moves," said Peter Cardillo, chief market economist at First Standard Financial.
The final University of Michigan consumer sentiment survey for December was 92.6, up from 91.3 in November.
Durable goods orders were unchanged in November. Non-defense capital goods orders excluding aircraft, a closely watched proxy for business spending plans, fell 0.4 percent last month and October's print was revised to show a smaller rise of 0.6 percent from the previously reported 1.3 percent increase.
U.S. personal income rose 0.3 percent. In the 12 months through November, the personal consumption expenditures (PCE) price index was up 0.4 percent after rising 0.2 percent in October, Reuters said. Excluding food and energy, prices nudged up 0.1 percent after being unchanged in October. The so-called core PCE price index rose 1.3 percent in the 12 months through November, for the 11th straight month.
U.S. consumer spending rose by 0.3 percent last month after holding steady in October, according to figures inadvertently released late on Tuesday by the Commerce Department. The data was originally due for release at 8:30 a.m. Wednesday.
Treasury yields traded higher, with the near 0.99 percent and the 10-year yield at 2.26 percent.
The U.S. dollar traded a touch higher, with the euro near $1.09 and the yen at 120.88 yen against the greenback.
New home sales rose 4.3 percent in November to a seasonally adjusted annual rate of 490,000 units, following a downward revision to October's sales pace to 470,000 units. The report came after Tuesday's weak existing home sales numbers.
Wednesday is the last full trading day of the week, as Thursday is a half day for the Christmas Eve holiday. Markets are closed Friday for Christmas Day.
"I think this is our Santa Claus rally. The market got to levels that were extremely oversold and was due for a bounce. (These) three days, that's shifted the market to where we're overbought," said Matthew Tuttle of Tuttle Tactical Management.
Weighing on the Dow, Nike closed down nearly 2.4 percent in afternoon trade after initially rallying. The stock's scheduled 2-for-1 split is expected to take effect when shares reopen for trade Thursday.
Nike reported earnings that beat but revenue that missed slightly. The athletic footwear and apparel maker's stock got a particular boost in after-hours trade from a 20 percent increase in future orders, a number which excludes the impact of currency fluctuations.
The closed up 25.32 points, or 1.24 percent, at 2,064.29, with energy leading all 10 sectors higher.
The Nasdaq composite closed up 44.82 points, or 0.90 percent, at 5,045.93.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, ended near 15.5, falling below 16 for the first time in two weeks.
About 13 stocks advanced for every two decliners on the New York Stock Exchange, with an exchange volume of 842 million and a composite volume of nearly 3.5 billion in the close.
Gold futures for February delivery settled down $5.80 at $1,068.30 an ounce.
—Reuters and CNBC's Peter Schacknow contributed to this report.
On tap this week:
Stock market closes at 1 p.m.
8:30 a.m.: Initial claims
10:30 a.m.: Natural gas inventories
Christmas Day holiday
*Planner subject to change.
More From CNBC.com: