U.S. Federal Reserve chief Ben Bernanke on Friday offered his clearest signal yet that he thinks a global recovery is at hand, but warned growth would be sluggish and unemployment stubbornly high.

After contracting sharply over the past year, economic activity appears to be leveling out, both in the United States and abroad, and the prospects for a return to growth in the near term appear good, Bernanke told an annual Fed conference here in the shadows of the Grand Teton mountains.

Bernanke, speaking to central bankers and top economists from around the world, said aggressive policy actions had managed to avert what could have been a worse outcome, but he stopped short of issuing an all-clear.

Although we have avoided the worst, difficult challenges still lie ahead, he said, cautioning that the recovery is likely to be relatively slow at first, with unemployment declining only gradually from high levels.

His remarks went a small step beyond a statement from Fed policy-makers last week in which the central bank simply acknowledged the U.S. economy was leveling out.

U.S. stocks rallied on Bernanke's cautious optimism and better-than-expected data on U.S. home sales, with the benchmark S&P 500 index rising to a new 10-month high.

Bernanke said critical challenges remain from financial markets still strained from the severe crisis that broke two years ago. The difficulties households and businesses face in getting loans is another source of stress, he said.

Analysts said the guarded remarks were in keeping with the view the U.S. central bank would be very cautious in moving to remove the enormous support it has provided to the economy.

The recession may have ended, but it's still a very challenging environment out there, said Mark Vitner, senior economist at Wells Fargo in Charlotte, North Carolina. The Fed has to be careful about withdrawing the liquidity from the economy.

CRISIS PREVENTION

Germany, France and Japan have pulled out of recession and the U.S. economy appears to be stabilizing as well.

The Fed chopped interest rates to near zero in December and has pumped around $1 trillion into financial markets to combat the crisis and spur economic growth.

It has said it plans to keep rates unusually low for an extended period to help pull the economy out from its deepest recession since the 1930s, but it has begun to dial back some of its emergency measures. Last week, it said it would phase out its purchases of long-term U.S. Treasuries.

The Fed's actions have gained traction. Data out on Friday showed previously owned U.S. homes sold at the fastest pace in two years in July. [ID:nN21378170]

While the U.S. economy appears to be gaining health, analysts worry a recovery could prove fleeting.

Expectations for solid growth in the second half of the year reflect the impact of a government program to spur car buying and an anticipated restocking of inventories. U.S. consumer demand is still weak and unemployment is rising.

In his talk, Bernanke recapped how central banks reacted to the series of flashpoints in the crisis. Without speedy actions by the Fed -- some of which were unfortunately unavoidable -- the panic could have intensified, he said.

Declining use of some of the Fed's emergency facilities is a clear signal financial markets are normalizing, he added.

As severe as the economic impact has been ... the outcome could have been decidedly worse, Bernanke said.

(Editing by Andrea Ricci)