Sales of previously owned U.S. homes jumped 7.2 percent in July to mark the fastest pace in nearly two years, a survey showed on Friday, in a strong sign that housing is pulling out of a three-year slump.

Sales in July rose for the fourth straight month to hit an annual rate of 5.24 million units, the highest since August 2007, the National Association of Realtors said. The total beat market expectations of a 5 million unit pace and June's 4.89 million pace.

July's increase was the largest monthly gain since the series started in 1999. The last time sales rose for four consecutive months was in June 2004, the NAR said.

The Realtors group heralded the July sales as a turning point, while other observers offered a more cautious view.

The housing market has decisively turned for the better. We are bouncing back. A combination of first-time buyers taking advantage of the housing stimulus tax credit and greatly improved affordability conditions are contributing to higher sales, NAR Chief Economist Lawrence Yun said.

With distressed sales accounting for 31 percent of the transactions in July, inventories rising and home prices remaining depressed, analysts said the housing market was not out of the woods yet.

The national median home price was $178,400 in July, down 15.1 percent from the same period last year, weighed down by distressed sales -- sales in foreclosure or close to it -- as such homes typically sell for 15 to 20 percent less than traditional homes.

It's really going to take home prices to broadly stabilize and come back a bit before you want to characterize the housing market as being fully recovering, said Craig Thomas, a senior economist at PNC Financial Services Group in Pittsburgh.

I will say there is not an indicator out there that doesn't suggest we are not moving in that direction.

White House spokesman Robert Gibbs said the housing market appeared to be bottoming out.

U.S. STOCKS RALLY

U.S. stocks rallied to new 2009 highs on the robust report, with shares of home builders posting hefty gains. D.R. Horton Inc gained 3.6 percent, while luxury home builder Toll Brothers Inc was up 3.7 percent. A broader measure of home construction stocks was up 3.65 percent.

Treasury debt prices fell as investors viewed the data as another indication that the recession that started in 2007 was close to an end, if not over.

U.S. Federal Reserve Chairman Ben Bernanke, speaking at a gathering of central bankers and top economists in Jackson Hole, Wyoming, said economic activity appeared to be leveling off, both in the United States and abroad, and prospects for a return to growth looked good in the near term.

The housing market is at the epicenter of the worst U.S. recession in 70 years. A recovery in the housing market would help to draw a line under losses at financial institutions, which have been battered by defaults on mortgages.

It would also improve the psychology of households, whose net worth has been decimated by the plunge in home values, and encourage them to spend rather than save to make up for lost wealth, analysts say.

Even more encouraging, existing homes sales in July were 5 percent higher compared with the same period last year, the biggest year-on-year gain since November 2005.

The improvement in July sales was broad-based, with sales of single-family homes, the worst-hit segment of the market, up 6.5 percent to an annual rate of 4.61 million units and multi-family dwellings up 12.5 percent to a 630,000 unit rate. Sales were up in three of the four regions.

Still, high unemployment threatens the budding recovery as many homeowners continue to lose their properties, and some economists question the sustainability of the economic recovery many see taking root.

A report from the Mortgage Bankers Association on Thursday showed late home loan payments jumped to a record high in the second quarter, with almost one in eight homeowners delinquent or in the process of foreclosure.

The inventory of existing homes for sale in July rose 7.3 percent to 4.09 million units from the previous month, NAR said. At July's sales pace, that represented a 9.4 months' supply, the same as in June.

The inventory overhang needs to be reduced significantly further before prices can start rising on a sustained basis. Overall, these figures may suggest that the recovery in housing activity is gathering pace, but there is a long way to go yet, said Paul Dales, U.S. economist at Capital Economics in Toronto.

(Additional reporting by Nick Zieminski in New York; editing by Leslie Adler and Dan Grebler)