Spain has the capacity, I think to double or triple pumped hydro capacity for overnight use, and solar thermal is another option, using molten salt to store heat to run turbines at night. That seems to be considered less cost-effective than batteries right now.
Massive battery farms may be the way forward. It seems crazy to think you could run a whole country on batteries, but it is actually becoming feasible now, I think.
I haven't researched this, but I feel that the 'one-size-fits-all' approach of the global economy may also be a problem. Spain could use that spare wind/solar generation to make green hydrogen for the vehicle fleet, but hydrogen doesn't seem to be a good option for many countries, so the manufacturers won't go for it.
Charging infrastructure will remain a problem here - lots of flats, far fewer houses with garages and driveways than in the UK/US/Germany. Hydrogen could be a good fit for Spain, but we can't go it alone.