Forgive my dumb question smile

I realize non EU citizens can only stay in Spain for 90 days on their tourist visas, so if I plan on staying in Spain for longer than that, can I hop a flight to a nearby country for the weekend to get it renewed (England, France, Portugal) or do I need to leave the EU (Morocco, Egypt, Israel, etc.) in order to have my tourist visa renewed for another 90 days?

Thanks!