For permanent residency, you just need 5 years of residence in the country and the main condition is that, during those 5 years, you haven’t been out of the country for more than 10 months at a time. You must also hold your investments during the five-year period and have a valid temporary residence permit. Whereas to obtain the Spanish citizenship you need to have lived in Spain for 10 years.