Selling a home that has tenants does not mean, under any circumstances, that the rental contract disappears immediately. The Urban Leasing Law (LAU), specifically in its article 14, establishes a clear protection framework for the tenant, forcing the new buyer to respect the legal deadlines and, in certain cases, imposing on the seller the obligation to compensate the tenant.
The contract is not touched: the minimum terms are mandatory
Spanish legislation states that the new owner automatically takes the position of the previous one and must respect the current contract. You cannot modify the conditions or expel the tenant during the minimum periods established by law:

Architects agree: blocks of flats that are more than 20 years old have humidity and insulation problems and the aluminum foil test should be done

Confirmed by justice: renting a room can also be considered habitual residence and requires the extension of the rental to 5 years
- If the seller is a natural person: the lease must be respected for at least 5 years.
- If the seller is a company: the mandatory retention period increases to 7 years.
Even if the contract includes a clause that says that the rental ends in the event of a sale, this clause is considered void compared to these legal minimums; The tenant is guaranteed their stay until that period is completed.
When is it mandatory to compensate?
Compensation arises mainly in long-term contracts (those signed for a period greater than the minimum 5 or 7 years).
If a homeowner signs a contract for, say, 10 years and decides to sell the house in the sixth year, the new buyer may have the right to terminate the contract (depending on the requirements of the Mortgage Law). It is in this early breakup scenario where the seller (the former owner) is required by law to compensate the tenant.
The amount of compensation
According to the literal text of the LAU, the compensation for the tenant must be an amount equivalent to one monthly payment of the current rent for each year of the contract that remains to be fulfilled, provided that this time exceeds the legal term of the initial 5 or 7 years.
In addition to this figure established by law, in legal practice compensation can be claimed linked to the damages caused, such as moving expenses or the price difference that the tenant must assume when searching for a new emergency rental.
Tips for landlords and tenants
So that neither party gets an unnecessary scare, it is essential to follow some basic advice that avoids those mistakes that, in the long run, are very expensive. The first thing is to always review the duration of the contract with a magnifying glass; It is vital to know if we are dealing with a short-term or long-term rental, since if the agreement is only for five years, the owner will not have to pay compensation at the end of the term, but the tenant will be able to rest easy knowing that no one can kick him out prematurely.
Furthermore, it is highly advisable to be proactive and include clear clauses in the original document about what would happen if you decide to sell the property, something that saves a lot of legal hassles and future discussions.
Finally, if you are going to buy a house, you must not forget to do a thorough prior analysis: you must be clear that if the home has a tenant with a current contract, this will totally condition the use that can be made of the new property in the short term.
