sandMore Americans felt financially secure enough to invest in vacation homes last year as the economy continued its recovery.

Annual sales jumped nearly 30% to 717,000 homes, according to the National Association of Realtors. Vacation home sales represented 13% of the total market, their highest share since 2006.

The sales were spurred by a strong stock market, according to Lawrence Yun, chief economist for the National Association of Realtors. The S&P 500 piled up a whopping 30% return in 2013, its best performance in 16 years. That provided investors with the funds and the confidence to purchase recreational property.

The main reason cited for buying was to use the homes as family vacation retreats. But 31% of buyers also said they planned to eventually use the homes as primary residences, often after they retire.More than a quarter of buyers said the purchase was to take advantage of good deals or to diversify their assets. Almost as many planned to rent to others, at least part of the year.

NAR’s report also covered purchases of second homes for investment purposes. Those sales fell 8.5% year-over-year to 1.1 million.”Investment buyers slowed their purchasing in 2013 because prices were rising quickly,” said Yun, who also cited the drop in the number of foreclosures available for the decline.