I applied for a remote job in the states and looked this up.
In the case of working from Spain for an American company, you pay American taxes, and if those add up to less than what you would have paid in Spain, you pay Spain the remainder.
In the case of working from Spain for an American company, you pay American taxes, and if those add up to less than what you would have paid in Spain, you pay Spain the remainder.