Prices of U.S. single-family homes gained more than expected in June and rose in the second quarter, reflecting the lingering boost from homebuyer tax credits that ended in April, Standard & Poor's/Case Shiller home price indexes showed on Tuesday.

The effects of buyer tax credits have largely filtered through and home prices will be hard-pressed to sustain these gains with unemployment still near 10 percent, economists agree.

This is the last hurrah for the tax credit, said Gary Shilling, president of A. Gary Shilling & Co. in Springfield, New Jersey. The data we've seen for July suggests considerable weakness in both sales and prices.

The S&P/Case Shiller composite index of 20 metropolitan areas rose 0.3 percent in June from May on a seasonally adjusted basis. The rise was better than the 0.2 percent increase expected by economists polled by Reuters, though slower than the 0.5 percent rise in May.

Unadjusted, the 20-city index gained 1 percent following May's 1.3 percent jump. In the year, prices rose 4.2 percent, surpassing the Reuters forecast of 3.9 percent.

S&P, which publishes the indexes, also said home prices nationally rose 4.4 percent in the second quarter after a 2.8 percent drop in the first quarter.

Prices rose in 17 of the 20 metro areas in June, S&P said, adding that in the first half of the year 15 of the 20 areas had positive annual growth rates. The housing market is in better shape than a year ago, S&P said.

Most cities posted smaller price gains in June, though, and the annual growth rates slowed in 14 of the metro areas.

The worry starts when you remember that the Homebuyers' Tax Credit has expired, foreclosures are still at high levels, and July data on home sales and starts were very, very weak, David M. Blitzer, chairman of the index committee at S&P, said in a statement.

The inventory of unsold homes and months' supply data were particularly troubling, he said, adding that if this relative weakness in demand continues, it will likely filter through to home prices in coming months.

Home prices in the 20 metro areas tracked by S&P remain 28.4 percent below the peak set in mid-2006.

July sales of existing homes eased to the slowest pace in 15 years and new home sales dropped to the slowest pace on record, the latest evidence that tight lending and the loss of home equity have stifled buying and mobility.

Unemployment and foreclosures help make housing a ship that will be painfully slow to turn around.

The recent home price improvement doesn't say that housing is back on firm footing, and we're a long way from that, said Hugh Johnson, chief investment officer at Hugh Johnson Advisors LLC in Albany. There is still need for help, and that help probably will come from the federal government.

(Additional reporting by Ryan Vlastelica and Caroline Valetkevitch; Editing by Andrea Ricci)