Mortgage rates in the U.S. declined, giving homebuyers a chance to lock in the lowest loan costs in almost three years.

The average rate for a 30-year fixed mortgage was 3.49%, down from 3.58% last week and the lowest since October 2016, Freddie Mac data showed Thursday. The 15-year average dropped to 3% from 3.06%.

Mortgage rates tracked the slide in 10-year Treasury yields as investors seek a haven amid growing fears that a recession is near. That’s creating opportunities for Americans who want to buy a home or cut their monthly payments by refinancing into a cheaper loan.

 “While economic growth is clearly slowing due to rising manufacturing and trade headwinds, economic fundamentals are still solid for U.S. consumers,” Sam Khater, chief economist at Freddie Mac, said in a statement. “The unemployment rate is low, housing affordability is improving, homebuyer demand is rising, and home price growth is stable.”

At the current average rate, the monthly payment on a $300,000, 30-year loan would be $1,345. That’s down from $1,527 a year ago, when the rate was 4.54%.

While refinancing is booming, lower borrowing costs haven’t been consistently pulling buyers into the market. Contracts to purchase previously owned U.S. homes slipped 2.5% in July from June, the first decline after two months of gains, the National Association of Realtors said last week. Tight supplies, particularly at the entry level, have put off some would-be buyers.

This article was provided by Bloomberg News.