Spain makes some very good wines and some very, very bad ones. If you just order a glass of red wine in Spain ('vino tinto'), the result might be a glass of something truly unpalatable. Don't let that put you off, most bars will have something better - you just have to ask for it.
As explained on this page on famous Spanish wines, the most popular wines in Spain are Rioja and Ribera del Duero. Every self-respecting bar in Spain will have at least one of each of these wines (many will only stock these wines). Go for one of these and you should get a nice wine.
However, considering just how famous these two wine regions are in Spain (many Spaniards don't know any other region), the prices of these two can be a little inflated. Which means that if there are two wines on the wine list, at the same price, and one is Rioja/Ribera del Duero while the other is a different one - go for the other one: it is likely to be a little less famous (hence the lower price) but equally good. On the other hand, the bar will likely sell a lot more of the Rioja or Ribera del Duero, which means that you are more likely to get a recently opened bottle if you go for the more famous wine.
See also What temperature should red wine be served at?
You will get less variety of white wine in Spain, with many bars only offering Rueda, which is a very good Spanish white.
Thanks to Mary O´Connor of Planeta Vino Wine Tasting School, Madrid for her help with this page.

