Long Island home sales spiked last month, driving prices up sharply in Nassau County but hardly at all in Suffolk.

The number of closed transactions increased year-over-year by nearly 18 percent in Nassau and 23 percent in Suffolk, the Multiple Listing Service of Long Island reported Friday.

In Nassau, the median price hit $480,000 in June, an annual increase of 9.1 percent. In Suffolk, the median price edged up year-over-year by just 1 percent, to $343,500, the listing service reported.

Nassau got the bigger bump in prices because buyers with high-paying jobs in New York City want a short commute, and they’re willing to pay for it, real estate brokers said.

“Nassau is the more prime area, closer to the city, that’s always the driving force,” said Joe Moshé, owner of Plainview-based Charles Rutenberg Realty.

But Suffolk attracts plenty of cost-conscious buyers, even if they’re not pushing up prices by much, Moshé said. “The competition isn’t as great in Suffolk as it is in Nassau, but there’s an influx of buyers out there because the homes are more affordable.”

advertisement | advertise on newsday

The Island also is feeling the effects of the city’s real estate boom, as buyers venture into the suburbs in search of more space for a lower price, Moshé said.

Nassau is even attracting some city residents seeking vacation homes in Gold Coast communities such as Matinecock and Locust Valley, since traffic tie-ups cause such long delays in getting to the Hamptons, said Kimberly Bancroft, a real estate agent with Daniel Gale Sotheby’s International Real Estate in Locust Valley.

Exterior of 12 Montana St., a recently sold property in Hicksville, Friday afternoon, July 15, 2016. Long Island home sales spiked last month, driving prices up sharply in Nassau County but hardly at all in Suffolk. Photo Credit: Danielle Finkelstein

The near-record low cost of borrowing also gives a boost to the housing market. The average interest rate for a 30-year, fixed-rate mortgage was 3.42 percent, mortgage giant Freddie Mac reported this week.

“I’ve had some people say they wanted to take advantage of the low rates,” Bancroft said.

Buyers had fewer properties to choose from in June, with only 15,259 homes listed for sale Islandwide, 17 percent fewer than in the same period in 2015.

At the current pace of sales, it would take just over five months to sell all the homes listed in Nassau and six months in Suffolk. A balanced housing market has a six- to eight-month supply of homes, brokers say.