Queens’ real estate market is perking up.

After lagging behind Manhattan and Brooklyn, Queens showed some positive signs in the second quarter as prices edged up and inventory fell.

“For the first time in a while you are seeing a much firmer market,” Jonathan Miller, CEO of real estate appraisal firm Miller Samuel, told the Daily News.

The median price of a home in the borough was $355,000, a 3.8% increase compared with last year, according to a report compiled by Miller Samuel for Prudential Douglas Elliman.

The number of home sales in Queens fell 2.3% to 2,306 and inventory was down sharpy, falling 33.3% to 8,754.

Prices were up in nearly every part of the borough, though certain pockets, like Northwest Queens – which includes the hot Astoria and Long Island City markets – led the way.

“Long Island City and Astoria are on fire,” said Eric Benaim, president of Modern Spaces, a real estate brokerage in Long Island City. “We are getting multiple bids on apartments. We are seeing bidding wars.”

Jim Pappas, president of Rock Realty in Jackson Heights, said he is seeing an uptick in prices, though “it’s in pockets,” of the borough.

The big factor pushing home sales in Queens: rock bottom interest rates.

“Rates are driving the market,” Pappas said.

But Pappas cautioned that it is still very difficult to qualify for a loan.

The Brooklyn market remained stable in the quarter, with the median price of a home at $477,108, down 0.6%, according to Prudential Douglas Elliman’s report.

Sales rose 2.4% to 1,988, while inventory dropped 17.6% to 5,772.

Frank Percesepe, senior regional vice president, Brooklyn at Corcoran, said he had previously been concerned that the market would slip this year because of a lack of new condos coming on to the market.

“But as that number came down, the resale of condos and coops had a dramatic increase,” Percesepe said.

One of the hottest segments in the market were townhouses. The average price of a one-family Brooklyn townhouse surged 28% to $1.87 million, according to Corcoran.

Percesepe said he sold a Brooklyn townhouse last week with an “extraordinarily aggressive asking price.”

The 25-foot wide home in a sought-after Brooklyn neighborhood was sold just one week after coming on the market at just 2% below the asking price.

“When it closes, it will break the record in that neighborhood,” Percesepe said. “This gives you an example of the health of the townhouse market. There are very few townhouses in Manhattan. We have a beautiful inventory. We have some of the best restaurants opening daily. People are flocking to Brooklyn.”