I bought a Telefonica SIM on my visit.
It wasn't cheap !! 60 euros including 12 euros of air time. It needs a top up at least once every 6 months to keep it active! It would seem the only failsafe way of doing this from outside of Spain is to get someone to go to a Telefonica shop, with your phone number and add the money ( minimum 5 euros) in person.
() / ()