Home prices in 20 major cities rose 2.2% from April to May, another indication of the housing market's continued recovery.

Home prices in the nation's biggest cities rose sharply from April to May, fresh data show, underscoring the strength of the housing market's spring recovery, which was marked by fewer foreclosures and tight inventory.

It was the second gain after seven months of declines for the Standard & Poor's/Case-Shiller index of 20 large cities. The 2.2% rise was also the strongest month-over-month percentage gain in more than a decade. And the 0.7% year-over-year decline was the most moderate annual drop since 2010, helping fuel optimism among analysts that the carefully watched gauge may soon begin posting year-over-year gains.

Nevertheless, the slowing economy and a steady stream of foreclosed properties will ensure that the housing market doesn't snap back to the heady days of the last bubble, experts said. The index may even give back some of its gains during the fall months when buying typically slows down, particularly in colder parts of the country such as the Northeast.

"What we are seeing in Case-Shiller is more evidence that housing did, in fact, firm as we entered into this spring.… It has been helped along by the lowest mortgage rates probably ever," said Michael D. Larson, a housing and interest rate analyst for Weiss Research. "Going forward the real issue is whether the economic improvement we saw earlier this year is petering out."

The rise in housing values comes at a tenuous time for the U.S. economy, with fears about an impending fiscal crisis at the end of the year beginning to hurt job growth domestically. Housing is highly dependent on a steady labor market, and a weak second-quarter economic report made it clear that the country remained in an anemic recovery.

The nation's gross domestic product, the value of all goods and services produced in the country, grew at a meager 1.5% annual rate in the second quarter, down from 2% in the first quarter and 4.1% in the final quarter last year. Meanwhile, national job growth was sluggish in June, although California's economy picked up with job gains in most industries.

Home sales also slowed in June, as inventory remained tight and buyers paid higher prices. In a rising market, sales should continue to improve from spring into summer, particularly as more deals initiated earlier in the year close.

The Case-Shiller index, created by economists Karl E. Case and Robert J. Shiller, is widely considered the most reliable read on home values. The housing index compares the latest sales of detached houses with previous sales and accounts for factors such as remodeling that might affect a house's sale price over time.

Case, a professor at Wellesley College, said that the state of the housing market could be viewed as a series of local battles between attractive areas where housing is in high demand and less-attractive areas where prices are still slumping. Currently, the areas in demand are winning out.

"In some of the good places or attractive places where people want to live, there is kind of a little frenzy going on because the inventory is low and people are jumping to buy properties," Case said. "At the other end of the spectrum, there are those properties that are still in foreclosure and not competing."

Moody's Analytics housing economist Celia Chen said that strong demand for distressed properties in some markets, particularly in Phoenix and parts of Florida, has helped firm up prices.

"I do expect that there is going to be some give-back of these gains later this year, and the fact that there are still distressed homes out there will just constrain price appreciation for a year," she said. "We will see price appreciation, but it won't be very strong."

Michelle Valverde, an economist with IHS Global Insight, wrote in an emailed analysis that home prices appear to be stabilizing and called the report "encouraging for the housing sector." The rise in prices could curb the number of foreclosures by reducing the large swath of homes still "underwater," properties that wouldn't sell for enough money to pay off the loans. Rising prices could also help give American wealth a boost, which might improve consumer spending.

"Some of the optimism should, nevertheless, be dampened by the fact that recent rises may be inflated by strong buying months in the spring and summer," she wrote. "It would be premature to conclude that the recent rise in home prices precludes future monthly price decreases."

All 20 cities in the index posted positive monthly results, according to the report released Tuesday. The May data showed that average home prices across the country were back to spring 2003 levels. Home prices are off about 33% from their peak in the summer of 2006.

Compared with the same month last year, the Los Angeles metro area posted a 2.0% decline, while San Diego was down 1.1%. San Francisco gained 0.6%.

Phoenix posted the best improvement with average home prices in that region up 11.5% versus May 2011. It was one of the hardest-hit cities in the Sun Belt, and prices remained 50% below their peak in June 2006, although the market has bounced back sharply this year. Miami and Tampa, Fla., are also improving, while Boston, Charlotte, N.C., and Detroit continue to slump.