Boston’s downtown condominium market soared in 2012, with the number of sales increasing dramatically and the median sale price reaching a record high, as prospective buyers battled over a shrinking housing stock.

Buyers closed deals on 3,324 condos in the city’s core neighborhoods last year, 28.9 percent more than in 2011, according to LINK, a Boston-based company that tracks the local condo market.

At the same time, the median sale price, or midpoint price, rose to $501,250 — the the highest ever — a 5.69 percent increase over the 2011 figure. LINK bases its findings on condo sales in 12 neighborhoods, including the Back Bay, Beacon Hill, South Boston, and the Fenway. But it omits others sections of the city, such as Allston, Brighton, Roxbury, and Mattapan.

Advertisement - Continue Reading Below

The strong showing comes as baby boomers and young professionals with good-paying tech jobs wage bidding wars in an area that was largely immune to the housing market’s collapse.

Since 2005, the median sale price for condos in downtown Boston has increased nearly 8 percent, from $465,000 to $501,250, LINK data show. During much of that period, the overall US housing market was crumbling.

Statewide, single-family home values are down about 16 percent and nationwide about 29 percent since the top of the market, according to the most recent data from the S&P/Case-Shiller home price indices, another housing tracker.

As the local economy improves, interest among all ages to live in an urban environment has risen, housing specialists say.

“The city is experiencing this tremendous demand and draw to live here,’’ said Kevin J. Ahearn, president of the Boston-based brokerage firm Otis & Ahearn Inc. “You have young millennials, and you have [people in their] 60s and 70s and everything in between.”

The city’s luxury market, which slowed significantly in 2009 during the national recession, also is quickly gaining speed. Sales in luxury buildings — which are defined as including full-service amenities such as concierge and valet services — rose by 24.6 percent last year compared with 2011, LINK reported.

The median sale price for luxury buildings also increased to a record-setting $762,500, nearly 6 percent higher than the price in 2011, according to the new figures.

“The luxury market is probably the strongest segment, where there is the most demand and the least amount of inventory,” said LINK president Debra Taylor Blair.

But while the scarcity of available properties has increased competition and pushed up prices, many worry the market will eventually start slowing unless more people put their homes on the market or large numbers of new properties are brought into the mix. For-sale inventory in the downtown area decreased in 2012 to record lows — with only 222 condos available at the end of the fourth quarter, LINK said.

Housing specialists are counting on the spring market attracting new sellers to keep the downtown momentum building through 2013.

“If you are a seller today, this is a terrific time to sell,’’ said Dave Stenberg, manager of Boston operations at Hammond Residential Real Estate. “The pace of the market is incredibly fast right now.”

Stenberg said he believes many sellers are not aware of the favorable market conditions. Meanwhile, prospective buyers need to be ready to make a quick offer on properties they like, he said. But Stenberg cautioned against acting in a panic — he doesn’t expect values to skyrocket like they did during the housing boom.

“Buyers should not think if they don’t do something today that the prices will shoot up 10 or 20 percent a year,’’ he said.