Wall Street extended a year-end rally on Friday as the S&P 500 rose for a fourth day and turned positive for the year after a recent run of better-than-expected economic data.

The S&P 500 has rallied nearly 5 percent over the last four days and is slightly higher for the year. Investors cited recent improvement in U.S. economic data and seasonal factors behind the move, but many are still cautious about the 2012 outlook.

The U.S. Congress approved a two-month extension of a payroll tax cut for 160 million American workers that otherwise would have expired on December 31. The resolution, if only temporary, removes a headwind for the market that investors said could have hit growth next year.

New U.S. single-family home sales rose to a seven-month high in November and the supply of houses on the market was the lowest in 5-1/2 years. The data added to signs of a budding recovery in the sector, which has been one of the biggest overhangs for markets this year.

More than anything, the better tone in housing is very suggestive that the jobs market's improved, said Jim Paulsen, chief investment officer at Wells Capital Management, adding that the latest data added more evidence that consumer spending and housing is responding to a little better jobs market.

The S&P 500 edged above its 200-day moving average, a level that has proved difficult for the index to hold after it plummeted below it in August. However, low holiday-season volume means investors are cautious of the move.

We are in the two-week silly period here so it's kind of hard to put too much significance on any of it, Paulsen said.

The Dow Jones industrial average <.DJI> gained 81.06 points, or 0.67 percent, to 12,250.71. The Standard & Poor's 500 Index <.SPX> rose 7.99 points, or 0.64 percent, to 1,261.99. The Nasdaq Composite Index <.IXIC> added 13.15 points, or 0.51 percent, to 2,612.60.

Volume was expected to be light ahead of the extended Christmas holiday weekend, and could spark exaggerated market swings. The New York Stock Exchange will observe normal trading hours on Friday, but the bond market will close at 2:00 p.m. EST (1900 GMT).

SunPower Corp jumped 7.5 percent to $6.29 after the solar panels maker reached a deal to acquire rival Tenesol, a unit of France's Total SA . At the same time, Total is buying 18.6 million SunPower shares, raising its stake to about 66 percent.

WPX Energy Inc will replace Compuware Corp in the S&P MidCap 400 index, Standard and Poor's said.

Exterran will replace Skyline Corp in the S&P SmallCap 600 index. The changes are effective at the close of trading on Friday, December 30.

Compuware fell 1.2 percent to $8.23, Exterran slid 4.1 percent to $9.15, and Skyline dropped 6 percent to $4.41.

(Reporting By Chuck Mikolajczak; Editing by Jan Paschal)