If you stay in Spain for more than 183 days a year, then the authorities will consider you a resident for tax purposes, which would make you liable for a range of taxes in Spain. However, if you have a temporary residence visa but only stay in Spain for less than 183 days a year, you'll be classed as a non-resident.