Buyers snapped up more than 4,000 single-family homes in Massachusetts last month, pushing the number of statewide sales for the first 10 months of 2012 above the total for all of last year.
Warren Group, a Boston real estate tracking company, reported Tuesday that home sales in October increased by 21 percent, to 4,044, compared with the same month last year, reflecting increased optimism about the state’s housing market.
Sales between January and October rose to 39,491, a 22 percent increase compared with those months in 2011.
“Record low mortgage rates, an improved economy, and growing consumer confidence are boosting the housing market in Massachusetts and around the country,” said Timothy M. Warren Jr., Warren Group’s chief executive.
The median home price remained relatively flat, however. For a single- family home, it held at $270,000 in October, similar to 12 months earlier, Warren Group said.
Between January and October, the median value slipped to $287,500, down nearly 1 percent compared with October 2011. That means half the properties sold above that price and half sold for less.
The state’s condominium market fared slightly better.
The inventory of single-family homes fell 23.5% in October, versus the same month last year.
Condo sales were up 48.8 percent in October, compared with the same time last year. The median price rose to $255,000, less than 1 percent higher than October 2011.
Between January and October, the median price for condos went up slightly to $275,000, less than 1 percent higher than a year earlier.
The Massachusetts Association of Realtors, which also released data on Tuesday, offered slightly better housing numbers.
The association said that the median value of a single-family home increased modestly in October to $287,000, 4.4 percent above the October 2011 median.
The median condo price rose to $265,000, up 2 percent compared with that month last year.
The association tracks data from three affiliated listing services, while Warren Group bases its numbers on sales filed at registries of deeds.
As more prospective buyers took action, the number of available homes continued to drop. The inventory of single-family homes decreased by 23.5 percent in October 2012, compared with the same month last year, and the number of condos for sale declined by 32.2 percent, compared with October, 2011, the association said.
John Ranco, a senior sales associate with Hammond Residential Real Estate, said he hopes more people list their homes for sale in the new year, in anticipation of the traditionally busy spring selling season. Right now, Ranco said, many buyers remain frustrated.
“There is very little to choose from,” he said.
Housing numbers released Tuesday by the S&P/Case-Shiller Home Price Indices showed Boston-area home prices increased by 1.9 percent in September, compared with that month last year.
Nationwide, home values rose about 3.6 percent in September, compared with 2011, according to the index, which measures repeat sales of the same properties and is considered one of the best measures of the nation’s housing market.
David M. Blitzer, chairman of the index committee at S&P Dow Jones Indices, said the latest figures provide further evidence that the housing market is ascending.
“With six months of consistently rising home prices, it is safe to say that we are now in the midst of a recovery in the housing market,’’ Blitzer said.Jenifer B. McKim can be reached at email@example.com. Follow her on Twitter