Spain offers you a mixture of international cities, and technology hubs. There will never be another "Silicon Valley", but as an alternative where you can find stimulating and rewarding work, I'd argue it's better than Portugal.
For work we find the technology community more diverse and deeper. Also for internationals choosing to move to somewhere attractive Spain offers a great balance of lifestyle and work. I would argue Lisbon is sort of the exception in Portugal; and even then it is a bit limited with no real domestic scene more people seeking low cost or nearshoring.
We were considering moving the company to Spain after Brexit but the reputation of the Spanish tax office as extremely bureaucratic and unfair is a huge deterrent.
Purportedly they can fine you tens of thousands of euros for tiny honest mistakes even if you don't owe one cent of tax (Modelo 720).
I prefer Portuguese people since I speak Portuguese and Portuguese are much more welcoming and friendly. This could change with overtourism which also makes Lisbon comparably expensive. Spain is more diverse and still has cheap big cities. Cheaper than Lisbon.