NEW YORK (Reuters) - U.S. single-family home prices rose slightly less than expected on an annual basis in July, and the year-over-year gain was smaller than in the prior month, a survey showed on Tuesday.

The S&P CoreLogic Case-Shiller composite index of 20 metropolitan areas rose 5 percent in July on a year-over-year basis, retreating from the 5.1 percent climb in June and short of the estimate calling for a 5.1 percent increase from a Reuters poll of economists.

"Both the housing sector and the economy continue to expand with home prices continuing to rise at about a 5 percent annual rate," said David M. Blitzer, managing director and chairman of the index committee at S&P Dow Jones Indices.

"There is no reason to fear that another massive collapse is around the corner."

Prices in the 20 cities were flat in July from June on a seasonally adjusted basis, the survey showed, matching expectations.

On a non-seasonally adjusted basis, prices increased 0.6 percent from June.

Home prices in three U.S. cities, Denver, Seattle and Portland, Oregon, showed the highest year-over-year gains, the survey showed.

(Reporting by Chuck Mikolajczak; Editing by Meredith Mazzilli)