Permit for resident application.
With this 5-year Recident request permit. (mandatory for stays longer than 180 consecutive days in Spain).
Can you become a resident of Spain, it does mean that all your tax affairs will have to be done in Spain from now on.
You can apply in your passport country (read nationality) to avoid paying double for income taxation.
Inform yourself about the possible consequences for your pension and General Old Age Act (accrual) etc etc.. After 5 years (with good behaviour) you can apply for a permanent, after this you can requests a Spanish passport if you wish.