Enrique F Granados-González wrote:
Marry a Spaniard or a EU citizen....
I know, it sounds stupid, but it is a solution.
Now, seriously, perhaps you must appeal against that resolution, considering the times of Spanish administration probably you can stay here for a long, long time, and perhaps before you get a new job. Good luck!
Not sure what the situation is now, but it used to be that a non-EU citizen had to be married to a Spaniard (or EU citizen) for 3 years before a Spanish residence permit would be granted on those grounds.