You can apply for Spanish nationality after 10 years of residence in Spain. You can also acquire Spanish nationality by marriage or by birth (in this case 1 year of residence in Spain is required), even if you or your Spanish parents were born outside Spain.