The UK had/has the exact same windfall tax on energy:
https://www.gov.uk/government/publications/electricity-gener... https://www.gov.uk/government/publications/energy-profits-le...
And the reason Spain is so well insulated is because they have limited gas interconnection so they have a 'captive supplier' in Algerian gas. Algerian gas can basically only go to Spain, Morocco or the domestic Algerian market. They have some limited LNG export capacity (which is growing and will significantly change the price Spain pays longer term).
Spain has the advantage that solar is very effective because it's further south than most of Europe. Solar now seems to be 20-25% of Spain's electricity mix (and rapidly increasing). As cost the projected costs [1]:
> We anticipate low solar capture prices of close to €25/MWh in 2027 and €20/MWh in 2028
> And the reason Spain is so well insulated is because they have limited gas interconnection so they have a 'captive supplier' in Algerian gas
Interestingly, this is also a factor in US pricing of natural gas and oil. The hotly contested (and ultimately cancelled) Keystone SL pipeline was designing to bring energy products to a wider market and ultimately to raise prices. Don't believe anyone who tells you oil companies build pipelines to lower prices. As an aside, different pipelines were built instead without the same controversy.
[1]: https://www.spglobal.com/ratings/en/regulatory/article/spain...