The Massachusetts housing market made a comeback last year, with 46,887 single-family homes sold — the best showing since 2006.
Single-family home sales statewide rose by 18.4 percent in 2012 compared with 2011, according to Warren Group, a private company that tracks real estate. Prices also rose, with the median price, or midpoint price, climbing a modest 1.8 percent compared with 2011, to $290,000.
The new data seem to confirm what housing specialists have been saying for months — that the Massachusetts and US housing markets have turned a corner. The state’s single-family housing market hit a price peak in 2005 — at $355,000 — before dropping about 20 percent by 2009, Warren Group said. Home values have fluctuated, but now appear to be strengthening steadily, especially in the Boston area.
This year “is going to be the base the housing recovery is built on,’’ said Alex Coon, a Boston market manager for the online brokerage firm Redfin.
The state’s condominium market also is improving, with sales rising more than 25 percent in 2012 compared with the previous year, marking the highest number of condo sales in Massachusetts since 2008, according to Warren Group. The median condo sale price rose $277,000 in 2012, up 2.6 percent from 2011.
The annual data were given a boost by brisk activity in December. Single-family home sales jumped by 8 percent compared with December 2011. Median home values rose to $300,000, a 12.3 percent increase compared with the same time in 2011, according to Warren Group.
Condo sales also increased by 5.4 percent in December, compared with December 2011. The median condo sale price increased to $275,000 last month, 8 percent higher than during the previous December.
“It is clear we have turned the corner and are gaining ground rapidly,’’ said Timothy M. Warren Jr., chief executive of Warren Group.
Greater Boston showed even better numbers in 2012, with the median price for single-family homes hitting $470,000, 6.8 higher than in 2011, the Greater Boston Association of Realtors said. The group includes communities largely within the Interstate 495 loop. Condo prices in that region rose to $380,000 , a 10.3 percent increase compared with 2011.
But as more buyers compete for homes, the number of properties on the market continues to shrink.
The inventory of single-family homes fell by 28.1 percent at the end of December, compared with 2011, according to the Massachusetts Association of Realtors, which also released data Thursday.
The number of condos for sale fell by 34.3 percent in December, compared with 2011, the association said.
John Ranco, senior associate at Hammond Residential Real Estate in Boston’s South End, said the lack of homes to sell is proving a challenge to the market’s recovery.
“We seem to have lots and lots of people looking for housing and very, very little to choose from,’’ he said. “It’s a little bit of a horse race to get properties into agreement right now.”
Christopher Doherty, president of the Northeast Association of Realtors, said he hopes more people start to realize now is a good time to put their homes on the market. “Buyers are out looking now, and every property that comes to the market is getting tremendous attention,” he said.Jenifer B. McKim can be reached at email@example.com. Follow her on twitter @jbmckim.