Long Island home sales spiked last month, as buyers scrambled to close deals before a predicted rise in interest rates.

In Suffolk County, buyers closed on 1,284 home sales in December, a 17.8 percent increase compared with the same period in 2014, a report released Wednesday by the Multiple Listing Service of Long Island shows. The county’s median price jumped by 5.2 percent from the year-earlier period, to $326,000.

Nassau County home sales rose last month by 7.4 percent year-over-year, with 1,045 transactions closing, the listing service reported. The median price in Nassau ticked up by 2.8 percent annually, to $437,000.

The number of homes going into contract in December jumped by 28.6 percent year-over-year in Suffolk and 18 percent in Nassau, listing service figures show.

With prices rising, homebuyers are gravitating to more affordable properties in Suffolk County, despite the longer commute to jobs in New York City, said Joe Moshé, broker-owner of Plainview-based Charles Rutenberg Realty.

And with interest rates expected to creep up this year, more homebuyers are starting to “get serious about buying something,” Moshé said. “Now this creates that sense of urgency.”

The Federal Reserve raised short-term interest rates last month, and it has indicated that there will be further “gradual” increases this year. The moves are expected to result in slow gains in mortgage interest rates.

advertisement | advertise on newsday

The average interest rate for a 30-year, fixed-rate mortgage was 3.97 percent, an increase of 0.24 percentage point compared to a year earlier, mortgage giant Freddie Mac reported last week.

As prices tick up in Suffolk County, less costly communities such as Mastic and Shirley are generating more interest among homebuyers, said Steve Abruzzo, an associate broker with Gateway to the Hamptons Real Estate in Center Moriches.

With so much sales activity, buyers have fewer homes to choose from. In Suffolk, it would take 6.6 months to sell all listed homes at the current pace of sales — the lowest level since at least 2010, according to listing service figures. In Nassau, it would take 4.9 months, the lowest level since at least 2011. A balanced real estate market has a six- to eight-month supply of homes, brokers say.