To really understand a city, you need to meet the locals. One of the most authentic ways to do that is to stay in someone's house in Spain. In many guesthouses, you are doing just that, but it's even cheaper and a more rewarding experience to stay at a local individual or family's home.
Sleep on Someone's Couch or Spare Bed for 'Free'
Though often referred to as 'couchsurfing' (because of the famous site of the same name), most who offer a 'couch' for the night actually have a bed for you to sleep in. They rarely charge anything and are also very keen to show you around the city. What more could you ask for?
Even if you don't need a place to sleep, couchsurfers often like to act as tour guides, showing you around the city you're visiting.
But Be Sure to Give Something Back
Note that many couchsurfers don't want to be used as free accommodation. Couchsurfing is a social thing -- guests that leave early in the morning and come back late at night and don't interact with their hosts aren't appreciated. There are three main couchsurfing websites:
Pay to Stay at Someone's Home with Airbnb and More
Sometimes it is more desirable to just pay for a room. Why? Because, as mentioned above, Couchsurfing is seen as a social activity by those offering you a piece of their living space: 99% of them want you to interact with them. But if you have a busy itinerary and don't want to have to deal with such pleasantries, renting a room in someone's apartment might be the best option for you. You still get the advantages of staying in a residential part of town, with all the perks of staying with locals rather than in a soulless hotel, but without the need to be friendly. In addition to Airbnb, there is VRBO and an aggregator of all their smaller competitors called Tripping.com.
A similar service, but aimed at longer stays, is the Nestpick service. Currently only available in 30 cities (including a few in Spain), Nestpick is great for those who don't want a pricey per-night rate. An option such as this is particularly useful if you're planning on learning Spanish in Spain.
Home Exchange: Couchsurfing for Grown-Ups
If Couchsurfing sounds too 'studenty' for you, try a home exchange instead. For a small fee (about the price of one night's accommodation in a medium-priced hotel) the Home Exchange website allows you to communicate with people in your chosen country and arrange a short-term exchange -- they come and stay in your home, you stay in theirs. Usually, this is done at the same time, but if both houses have spare rooms, you could travel at different times and host your new-found friends in person. What's more, after you've paid the registration fee, you can use the service as often as you like.
NightSwapping: A Couchsurfing-Home Exchange Hybrid
Another service similar to Couchsurfing is NightSwapping. The emphasis here is on weeding out the freeloaders by insisting that you offer your room or apartment to 'earn' nights in other people's homes. The service works both for entire apartments and rooms.