WASHINGTON—Home-buyers bought more new homes in June, a bright spot in the beleaguered housing sector.

Purchases of newly built single-family homes increased 7% from the prior month to a seasonally adjusted annual rate of 646,000 in June, the Commerce Department said Wednesday. The increase follows two straight months of declines. Economists surveyed by The Wall Street Journal has expected a sales pace of 659,000.

The number of homes for sale in June would last 6.3 months at the current pace. That’s up from 6 months a year earlier. The median sales price of a new home in June was $310,400, roughly the same as a year ago, when the median sales price was $310,500. From a year ago, new home sales were up 4.5%.

Sales data can be volatile and subject to revisions. The June increase came with a margin of error of plus or minus 15.2 percentage points. Sales in May were revised down to a seasonally adjusted annual rate of 604,000 from an initial estimate of 626,000.

New-home sales are a relatively narrow slice of all U.S. home sales. About 90% of homes purchased were previously owned.

Existing-home sales are moving in the opposite direction. Sales in that market fell 1.7% in June to a seasonally adjusted annual pace of 5.27 million, the National Association of Realtors said Tuesday.

Low unemployment and rising wages have put more households in a position to buy. At the same time, mortgage rates have been held down by the prospect of a cut in interest rates next week by the Federal Reserve. As of last week, the average rate for a 30-year mortgage was about 3.8%, down from 4.5% a year ago, according to Freddie Mac.

Wednesday’s report showed new home sales falling in the Northeast and the Midwest, where they fell to the lowest level since September 2015. But sales rose strongly in the West in June after slumping in May. Sales in the South were roughly on par with the previous month.

As featured on realtor.com