Having Spanish citizenship presents many benefits as you can not only travel, live and work legally in Spain but also in any other European Union member country. Getting Spanish citizenship on the grounds of residency simply means you have been legally long enough in the country to be able to qualify for Spanish nationality.
The time you need to be living in this country to be able to apply for citizenship varies from case to case. As a general rule, immigrants living in Spain with a residence permit continuously for ten years or more can apply for citizenship on the grounds of residency. However, there are certain exceptions in which less time is required. For example, if you are from Latin America, Portugal, the Philippines, Andorra or Equatorial Guinea you only have to live in Spain for 2 years to be eligible. If your partner is Spanish you only need to reside here for a year before applying. Finally, if you are granted refugee status, you can apply after 5 years.