It was the best May in history for Twin Cities home sellers, with house prices inching close to an all-time high, the Minneapolis Area Association of Realtors said Tuesday in its monthly report.

There were 6,167 home sales, up 5.3 percent from last year and the highest May closed-sales figure on record. The median price of those sales rose 5.7 percent to $236,826, which was second only to June 2006 for the monthly median record.

“Interest rates and job growth are fueling the demand in our market,” said Cotty Lowry, the association’s president-elect. “But we have a serious inventory shortage that we know is holding back buyers, meaning there is still pent-up demand that may not have existed in a more-balanced market.”

The housing market in the Twin Cities is like that of many major metropolitan areas where the unemployment rate is low and millennials are getting to an age where they think more seriously about homeownership. Buyers are motivated by rising rents, mortgage interest rates that are near all-time lows and growing concern that if they don’t buy now, they will be priced out of the market later.

Assuming that demand continues apace, it’s likely that within the next month or two the median sale price will reach or exceed an all-time high.

First-time buyers are fueling the market, concentrating demand for houses priced at less than $350,000. Generally, the higher the price the more balanced the market, and the data show that houses priced at more than $1 million are taking more than a year to sell. Buyers are passing over houses with dated decorating and unpopular floor plans, which still take several months to sell.

“Despite record demand, not every home sells the day it hits the market in multiple offers,” Judy Shields, the association’s current president, said in a statement. “Some areas are more susceptible than others. Sellers hoping for short market times should know price strategy is still one of the most important factors in marketing your home.”

Though the peak of the spring home buying season is winding down, there’s no indication the market is going to cool anytime soon. Last month, buyers signed 6,809 purchase agreements, 9.9 percent more than in May of last year and the 18th consecutive annual increase in pending sales — an indication of future closings.

Sales outpaced new listings in some areas and new listings declined significantly, causing the total number of properties on the market at the end of May to fall 20.6 percent to 13,372 active properties.

The imbalance between buyers and sellers is causing fierce competition and many buyers have been outbid several times during their house hunt. During the month, at least half of all sellers got more than their most recent asking price and the average market time fell 21.1 percent to 60 days — the fastest for any month since the beginning of 2007.

Tony Miller, an agent with Better Homes and Garden Real Estate in Edina, said that a typical open house in south Minneapolis might draw 50 to 100 visitors within two hours.

Sellers are becoming so accustomed to receiving multiple offers, he said, that even after receiving an offer some aren’t responding to it immediately because they might have several more showings and the prospect of more offers that same day. A lot of buyers are writing offers that include a request for the sellers to respond within four to six hours.

“It’s happening because the buyers are seeing that there’s nothing out there,” Miller said. “And the sellers are willing to be patient.”

At the current sales pace, there are now enough houses on the market to last just 2.7 months — a 28.9 percent decline compared with last year and the lowest May figure on record since the beginning of 2003. A five- to six-month supply is considered balanced.