Contracts to purchase previously owned U.S. homes matched a two-year high in May, fueling optimism the housing market is poised for a recovery.

The National Association of Realtors said on Wednesday its Pending Home Sales Index, based on contracts signed last month, rose 5.9% to 101.1. The index level matched the two-year high reached in March, while the gain was the largest since October 2011.

Before March, the last time pending home sales were as high was April 2010 when buyers were rushing to beat the deadline for a home-buyer tax credit, which was about to expire, the NAR said.

"The housing market is clearly superior this year compared with the past four years,'' Lawrence Yun, NAR chief economist said in a statement. ``We're on track to see a 9 to 10% improvement in total sales for 2012.''

Economists polled by Reuters had expected signed contracts, which lead home sales by a month or two, to rise 1.0% after a previously reported 5.5% drop in April.