Withdrawing the contract before six months of length since its application may cost you a compensation to your landlord, so you’ll need to think twice before making the decision. If you want to retract from what’s been negotiated on your contract, you must anticipate your landlord 30 days before as it is mandated in the Article 11 of the Urban Leasing Law.
The parties will count with the opening of agreeing in the contract that, in the event of withdrawal, the tenant must compensate the landlord with an amount equivalent to one month's rent for each year of the contract remaining to be fulfilled.
Therefore, if you want to exercise your right of withdrawal and leave as soon as possible, you should inform your landlord 30 days before your wish to leave. In the meantime you must continue to pay rent. In other words, if the tenant tells the landlord that he is leaving tomorrow, he can do so, but he will have to pay the landlord the 30-day notice he has not given.
In the cases where the contract has completed the first 12 months and has been extended for another year, 6 months do not have to pass again for the tenant to be able to withdraw, the 6-month requirement is only for the first year of the contract.
And the same will happen if the contract is extended for a second time or even for the third year of the contract. The tenant counts with the right of canceling the contract from the first moment.