Advise from a local here,
I have been with all 3 major carriers (voda, orange, Movistar).
for short stays Movistar is the best deal, they offer daily unlimited plans, have the best coverage in Spain however ironically not the best 4G. Think of it as the Spanish Telstra, good coverages, lots of shops all over Spain and expensive with not so friendly staff.
For longer stays the best deals are Voda, they have the second best coverage and one of the best 4G networks in Spain, they offer much more generous monthly pre paid data allowances than the competition and have good stores with friendly staff.
if you are roaming around Europe, voda is also great, they allow international roaming for very few euro (top of my head can't remember how much but it was pocket change) and works on networks all over Europe for the same cost on your same plan, even worked a treat at DXB! Think of it as the Spanish Optus, cheap, good data allowance with fast speed and acceptable coverage, very friendly staff.
Orange, I only recommend to people who have a crippling fear of fast internet speeds and enjoy constant drop outs when walking inside buildings. Jokes aside, Orange provides adequate coverage in major cities (Madrid or Barcelona). So if you are staying in the city, it's viable choice. Price wise, heir pre paid plans are a bit odd, depending on how much data you use, for instance there isn't a monthly pre paid plan that offers more than 1gb. Think about it as the Spanish Vodafone, slow and unreliable when you get off the city, fewer shops than the others and very inflexible plans.
Finally, I'd like to give a shout to a new carrier called Yoigo, they are new to the Spanish scene and offer what some consider the best 4G network in Spain, reminds me of EE in the UK. I haven't tried it so I can't recommend it, but if someone wants to give them a shot, let us know.