What is your situation in Spain at the moment?
Spain — Naturalization
Spanish citizenship by residence can only be earned from inside Spain, under a permit — there is no way to serve the time from abroad, and visits, holidays and owning property do not count. So this first question decides more than any other, and it is worth answering precisely. If you are unsure which category your permit falls into, say so: Spanish law draws a hard line between a residence and a stay, and a great many people are on the wrong side of it without realising.
I live in Spain with a residence permit — work, self-employment, family, non-lucrative, remote work or long-term → I live in Spain on a student permit → I have refugee status in Spain → I live in Spain but without a permit → I don't live in Spain → I'm not sure whether what I hold counts as residence →