Tech salaries in Spain are not higher than for other sectors, as the tech sector is still very small, and most jobs are inside "cost centers" of other companies (banks, telcos, etc.).
A typical (good!) staring salary would be 25k for Madrid or 20k for Barcelona. In contrast you'd see 40k in Paris or Berlin for a similar job. It's typical to have 14 monthly payments (with extra payment in July/August and Christmas), so that ends up being around 1200 euros net per month.

Quality of life is great, though, and not so expensive. The Lancet recently [1] put Spain's healthcare as 8th in the world, food is great, the social scene is very open to foreigners, climate is better than in northern europe, etc.

The worse part of your expenses in either Madrid or Barcelona will be renting an apartment, as prices are rising quickly (after the financial crisis, housing plummeted, so construction stopped. But now everyone with some extra cash is buying apartments for renting them, and there's extra pressure to make them a worthwhile investment).

Spain's economy is divided in tiny companies (PYMES), and huge companies. We lack a lot of medium sized companies such as the german mittelstands, and it shows on job mobility and opportunities. Compounding this with a small tech scene, it might be hard to find a job opportunity. But tech is growing quickly, as others have mentioned.

If you are functional in spanish, it shouldn't be a problem, but mind that spaniards are not so used to working with other nationalities, so you will be somewhat "exotic" and you will get a mild joke from time to time. You might find some "inferiority complex", particularly if you are german/french/american, as Spain has traditionally looked abroad for innovation and modernity references (famously pictured by Unamuno and his "Que inventen ellos" quote [2]).

The contracting area is dismal. Most of autonomos are either micropymes or false autonomos, actually working for one huge company, with total dependence and a huge risk, without the normal employee rights and securities. Spain is not accustomed to paying fair prices for contract work. And outside the tech scene, there will be often requests for working for free (typical for design or copy work), or without paying taxes ("cobrar en B").

On the Madrid vs. Barcelona topic I'm of course biased, being from Madrid, but I find that foreigners are initially much more familiar with Barcelona, and they overlook Madrid. Madrid is great! And more objectively: it is bigger, with more opportunities, without language problems (catalan might be an issue from time to time, mostly if you are still learning spanish, but you will also find people from time to time that refuse to speak spanish for political reasons), and with less tourists yet more foreigners (you will not be treated so much as a cash-cow tourist, as some of my friends have suffered a couple of times in Barcelona).

Overall, I'd say you can live very well in Spain, but it is not the place if you seek big career opportunities. Of course all of this is a HUGE simplification, and you can find excellent opportunities in Spain, and shitty opportunities elsewhere. I personally have a lot of french friends working in Madrid with excellent jobs and adamant on staying for the rest of their lives. And all of what I said is improving quickly; Spain got a really big economic push when entering the euro, and although the crisis stuck VERY hard, we are recovering and accelerating a lot!

[1] http://www.thelancet.com/journals/lancet/article/PIIS0140-67...
[2] (spanish) https://blogs.iadb.org/puntossobrelai/2016/06/06/que-invente...