There had previously been no legal limit on the duration of mortgages, and in fact many Swedish homeowners have been taking loans which only their grandchildren would have a chance to pay off.
The practice developed as a strategy to cope with high property prices as a longer term means monthly payments are lower. But inheritors are left with repaying the balance of the mortgage, often by selling the home.
Swedish regulators calculated in 2013 that the average mortgage term was around 140 years.
Nearly one-third of mortgages issued in 2014 allowed borrowers to repay only interest.
New mortgages will have a 105-year repayment limit as borrowers will be required to reimburse a minimum amount of the loan capital each year, after a five-year grace period on loans for new homes.
"It is important that we have a solid culture" of repayment, the chairman of the parliament's finance committee, Social-Democrat Fredrik Olovsson, was quoted as saying by the Aftonbladet newspaper.
Swedish banks opposed the law.
"It isn't good for the finances of households as it will make mortgages more expensive and the terms not as good. And it isn't good for financial stability," the head of Swedish Bankers' Association, Hans Lindberg, told the financial daily Dagens Industri.
Housing price inflation has resulted in Swedish households being among the most indebted in Europe. Mortgage holders on average have a debt that is 366 percent their annual income.