Sales of previously owned U.S. homes increased in July to a five-month high, underscoring stability in the residential real estate market that may be starting to get a boost from falling borrowing costs.

Contract closings rose 2.5% to a 5.42 million annual rate, the National Association of Realtors said Wednesday. That compares with the median forecast of a 5.40 million pace projected by economists in a Bloomberg survey. The median sales price increased 4.3% from a year earlier to $280,800.

Declining mortgage rates, smaller annual home price gains and robust labor conditions are laying the ground for a pickup in sales in the second half of 2019. At the same time, the market is being constrained by a shortage of inventory at the lower end of the market, likely limiting sales to first-time buyers.

The figures are consistent with recent figures that suggest the housing sector is slowly improving. The latest housing starts data showed construction of single-family homes increased to the highest level since January, while building permits also increased.

The July gain reflected “incredibly low mortgage rates and strong job market conditions,” Lawrence Yun, NAR’s chief economist, said at a briefing in Washington. Tepid sales during the first half of the year will probably be reversed by December, he said.

The annualized pace of June existing home sales was revised to 5.29 million from 5.27 million.

Home sales improved in three of the four U.S. regions, led by an 8.3% surge in the West; the 1.18 million pace in the West was the strongest in a year. Properties typically remained on the market for 29 days, while 51% of homes sold in July were on the market for less than a month.

At the current pace, it would take 4.2 months to sell all the homes on the market, compared with 4.4 months in June; Realtors see anything below five months of supply as a sign of a tight market.

First-time buyers made up 32% of sales in July, down from 35% the previous month. Home-price appreciation has been much stronger in the lower-price tier, reflecting lean inventory in that segment, the NAR said.

Existing-home sales account for about 90% of U.S. housing and are calculated when a contract closes. New-home sales, which make up the remainder, are counted when contracts are signed and will be released Friday.

With assistance from Bloomberg’s Jordan Yadoo.