The general rule is IMO (I'm not an accountant): You either are employed in the US and pay US taxes or you are a company or individual in Spain offering services to a US company, then you are taxed in Spain. The latter means you have no employment contract but a consulting contract.
I am European but I work also for American companies as consultant and as such I _have to_ pay taxes in my country of residence (Luxembourg).
The good thing in my case is you avoid VAT, the subjective thing (good or bad, depends on your perception) is that you are subject to the obligatory social security deductions ranging from 25% to 40% (in the countries I know).
Taxes must be paid as well if you pay social security but they shouldn't play the big role unless you earn big (>= 8k E per month)
Whether paying social security is good depends heavily on your country of residence and it is kind of up to you. I'd preferably not pay social security in Germany but in Luxembourg it's tolerable.