In order that any non Spanish national becomes a Spanish national they must reside in Spain for a period of ten years minimum (there are a few exceptions like oficial refugees or nationals of Spanish South America, Andorra, Philippines, Republic of Equatorial Guiena, Portugal, Sephardies…all of them needing a term of five year’s residence).
There are other exceptions (needing one year’s term) for other persons such as the ones who have born in Spain, people married to a Spanish national, etc, etc.
Therefore, in your case, and with the details you mentioned, you cannot at this time apply for the Spanish nationality.