U.S. stocks rallied to new 2009 highs on Friday on positive comments from Federal Reserve Chairman Ben Bernanke and data showing existing home sales rose for the fourth consecutive month.

The S&P 500 and the Nasdaq hit 10-month intraday highs, while the Dow industrials rose to their highest level in nine months.

At an annual Fed conference in Jackson Hole, Wyoming, Bernanke gave his clearest signal yet that a recovery is at hand, though cautioned that it would be sluggish for a time.

The fact that Bernanke suggests a recovery is under way and that it won't likely to be overly strong initially makes the market comfortable the Fed won't raise rates prematurely. That's a good environment for stocks, said Charles Lieberman, chief investment officer at Advisors Capital Management in Paramus, New Jersey.

Sales of previously owned U.S. homes jumped 7.2 percent in July, the fastest sales pace in nearly two years. On an annual rate, sales rose to 5.24 million units, better than expected.

The existing home sales data surprised a lot of investors, and investors are definitely in the buying mood, said Alan Lancz, president of Alan B. Lancz & Associates in Toledo, Ohio. Home prices are getting to a level that attracts bargain buyers and that's a big positive. A floor has been established.

The data sent the Dow Jones U.S. Home Construction index <.DJUSHB> up 3.4 percent to 293.46. Among the big U.S. home builders, D.R. Horton advanced 4 percent to $12.73, while Toll Brothers gained 3.8 percent to $22.74.

The Dow Jones industrial average <.DJI> rose 138.75 points, or 1.48 percent, to 9,488.80. The Standard & Poor's 500 Index <.SPX> added 16.47 points, or 1.63 percent, to 1,023.84. The Nasdaq Composite Index <.IXIC> climbed 26.69 points, or 1.34 percent, to 2,015.91.

In company news, J.M. Smucker climbed 3.9 percent to $53.90 after it reported its first-quarter results and gave a strong full-year outlook.

American International Group shares gained 3.3 percent to $33.37 on the news it had won dismissal of a federal lawsuit that accused it of fraudulently shortchanging state workers' compensation pools out of more than $1 billion.

In Europe, purchasing managers' indexes showed that the German and French private sectors grew in August, a week after data indicated the European heavyweights pulled out of recession in the second quarter.

The Bank of New York Mellon index of leading European American depositary receipts <.BKEUR> advanced 2.3 percent to 119.14 on Friday.

(Reporting by Ryan Vlastelica; Editing by Jan Paschal)