After 5 years of holding the temporary residence permit, you will be eligible for permanent residency. The permanent residency will entitle you to live and work in Spain indefinitely. After 10 years of legal residency (temporary or permanent) you may be eligible for naturalization.