But in a sign of the struggles still facing the broader economy, separate data on Tuesday showed consumer confidence fell to its lowest level in five months in June as Americans' view of the economy in the coming months soured.
The Standard &Poor's/Case-Shiller composite index of 20 metropolitan areas gained 0.7 percent on a seasonally adjusted basis, topping economists' expectations for a 0.4 percent gain.
Compared to a year ago, home prices fell 1.9 percent in the 20 cities, above expectations for a decline of 2.5 percent, and an improvement from the 2.6 percent annual decline seen in March.
April's gain made for the longest streak of consecutive monthly gains since prices were boosted by the homebuyer tax credit from mid-2009 into early 2010.
"The housing recovery in this cycle has been painfully slow to develop, but it is unmistakably here," said Chris Low, chief economist at FTN Financial in New York.
"This time, unlike 2010 when the first-time homebuyer tax credit lifted sales, it is happening with only limited help from the government."
Recent data has pointed to a housing market that has finally hit bottom and is stabilizing, including a report on Monday that showed new home sales hit a two-year high in May.
A Long Way to Go
Still, the housing market has a long way to go before full recovery as it faces a large pipeline of foreclosures, tight credit restrictions and weak demand.
Even as the housing market is firming, the broader economy is struggling under the weight of a sluggish labor market and fears over the fallout of Europe's debt crisis.
The Conference Board, an industry group, said its index of consumer attitudes fell to 62.0 from a downwardly revised 64.4 in May, falling short of economists expectations. It was the lowest level since January.
While consumers' assessment of their current situation improved, they were less upbeat about their expectations for the next six months. Fewer respondents expected business conditions or employment would improve in the coming months.
The index is down nearly 10 points from the peak hit in February. Consumer spending -- a major engine of economic growth during the housing boom -- accounts for about 70 percent of U.S. economic activity.
"It does reinforce that confidence continues to wane, which does keep pressure on the recovery," said Sean Incremona, economist at 4Cast Ltd in New York.
Financial markets saw little reaction to the data as investors had their attention on Europe after Spain's short-term borrowing costs nearly tripled at auction.
Copyright 2012 Thomson Reuters. Click for Restrictions.
Those Mortgages Blamed for Housing Crisis? They're Back
5 Things That Can Derail Your Home Sale
More on AOL Real Estate:
Find out how to calculate mortgage payments.
Find homes for sale in your area.
Find foreclosures in your area.
Find homes for rent in your area.
Follow us on Twitter at @AOLRealEstate or connect with AOL Real Estate on Facebook.