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.
Why is it better?
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).
If you have questions drop me a line.