Once you have acquired your residency, do not forget to KEEP IT RENEWED, that is to say in force, at least until you become Spanish.
In the vast majority of cases, you will be able to apply for renewal or modification of your residency 60 days before the expiration date and you have up to 90 days after (some exceptions apply) as in the case of Community Relative Residency, you must apply 30 days before the expiration date.
Ojo: If you do not renew your residency within the established period or you do not meet the requirements, you will lose your residency and you will be in an irregular situation.
In the case of Residency for Humanitarian Reasons, the request for extension after its expiration would apply.