Reposted from The BostonGlobe.com. Author: Tim Logan

The law of supply and demand is firmly at work in Boston’s housing market.

Sale prices on homes in Massachusetts hit new highs in January, amid a sharp decline in the number of properties for sale. Meanwhile, rents in the city of Boston — especially on older apartments — are starting to fall as a wave of new buildings open across the city.

The trends reflect a market that has shifted in favor of renters — for now, anyway — but remains expensive across the board.

The median price for a single-family home in the Bay State climbed to $342,500, up 7 percent in January over the same month last year, according to data from the Warren Group, a Boston-based real estate tracking firm. Condo prices climbed at a similar clip.

January is typically a slow month for home sales in Massachusetts, but the gains reported Tuesday continued an upward trend in prices in recent months, fueled by job growth, increased demand from young adults, and tightening inventory. A separate report Tuesday, based on the S&P CoreLogic Case-Shiller Index, said home prices in Greater Boston are at all-time highs, 8.5 percent ahead of their previous peak in 2005.

But supply has not kept pace.

Permits for new single-family homes have been relatively flat in recent years and remain well below the highs of the mid-2000s. Relatively few homeowners are listing their homes for sale. And what listings there are, are going quickly; the average home that sold in January was on the market for just 82 days, 32 days faster than a year ago.

All that has combined to squeeze inventory. The number of homes for sale in the state is down by about one-third compared with the same period last year, according to the Massachusetts Association of Realtors. 

“Remaining inventory is flying off the shelves,” said Paul Yorkis, president of Patriot Real Estate in Medway and head of the statewide association. “This is the lowest month’s supply of home listings that we have seen since MAR began recording the data in 2004.”

That combination of high prices and tight inventory led Bankrate.com, in a separate report out Tuesday, to rank Massachusetts the 10th-toughest state for first-time home buyers. It’s not likely to get easier this spring, said Ralph McLaughlin, chief economist at real estate website Truliaespecially as buyers confront mortgage interest rates that jumped in November after spending most of last year near record lows.

“This spring housing market is shaping up to be another doozy for home buyers,” he said. “Housing affordability is the key to helping break yet another year of gridlocked inventory, but all signs are showing that homes this spring will be much less affordable than last year.”

At least the rental market is showing signs of relief — in Boston, that is. The average rent on older apartments — those built before 2011 — fell 4 percent last year to an average of $1,983 a month, according to figures being released this week by Mayor Martin J. Walsh. That still puts Boston among the priciest apartment markets in the country, but it’s a sign that the 12,000 new apartments that have opened in the last few years are putting a dent in rents, and not just at the top end.

“We are definitely starting to see an impact,” said Sheila Dillon, Walsh’s chief of housing.

Dillon said she hopes that impact will grow as more apartments come on line. There are about 7,000 more now under construction in Boston, with another 22,000 proposed.

Tim Logan can be reached at tim.logan@globe.com. Follow him on Twitter at @bytimlogan.