Spain does not ask whether you meant to move there. It counts your days.

Three doors into Spanish tax residency

Spanish law gives the tax authority — the Agencia Tributaria, known informally as Hacienda — three separate tests for tax residency. Meeting any one of them is enough, and a Spanish tax resident is taxed on worldwide income, not only what they earn in Spain. The tests come from Article 9 of the personal income tax law (Ley 35/2006) and are set out in plain terms on the Agencia Tributaria's own pages:

  • More than 183 days in Spain during the calendar year.
  • Spain being the main base or centre of your economic interests.
  • A rebuttable presumption based on where your spouse and minor children live.

You only need to walk through one.

The 183-day count — and the absences that don't help

The headline rule: if you remain in Spanish territory for more than 183 days during a calendar year, you are tax resident (Agencia Tributaria IRPF manual). The days need not be consecutive — Hacienda looks at your cumulative presence across the whole year, 1 January to 31 December.

Here is the wrinkle that catches people. Sporadic absences are counted toward the 183 days unless you can prove tax residence in another country. A long weekend in Lisbon, a fortnight back home, a string of work trips — by default those days are still treated as days in Spain. To stop them counting, the taxpayer, not the tax office, has to prove residence elsewhere — typically with a tax-residence certificate issued by the competent tax authority of that other country. The burden of proof sits with you.

That single design choice is why "I was only there about half the year" is rarely enough on its own. The line between 183 and 184 days is exact, and the trips you assumed would pull you under it may not.

Days are not the only door

Even if you stay well under 183 days, Spain can still treat you as resident when the main core or base of your activities or economic interests is located in Spain, directly or indirectly. There is no day count attached to this test: where your work, your business, or the bulk of your income and assets sit can be enough on its own.

The family presumption

The third door is a presumption. The law presumes — unless you prove otherwise — that you are habitually resident in Spain when your spouse (not legally separated) and dependent minor children habitually reside there. The presumption can be rebutted, but, once more, the burden is on you to show otherwise.

Spain decides for the whole year

A final feature surprises new arrivals: Spain has no split-year treatment. You are either resident or non-resident for the entire calendar year — there is no half-year status for the period before you arrived or after you left (PwC summary of Spanish residence rules). So the count across the full 1 January–31 December window decides your status, even if you only moved mid-year.

Two practical notes sit alongside the tests:

  • A Spanish residence permit does not by itself make you a tax resident — and not holding one does not exempt you. Residency for tax turns on the tests above, not on your immigration card.
  • If two countries both claim you, a double-tax treaty usually breaks the tie using factors like your permanent home and centre of vital interests — but you still have to evidence where your days and your life actually were. We unpack both ideas in The "183-day rule" is not one rule and Dual tax residency and the treaty tie-breaker.

What this asks of you

Spanish tax residency rests on facts you are expected to be able to show: how many days you were physically in Spain, when you left and returned, and where your home and family were while you were away. Hacienda can presume continuity, count your absences against you, and ask you — not anyone else — to prove the alternative.

The practical defence is simple to describe and easy to neglect: a contemporaneous, day-by-day record of where you were. That is exactly what Countly keeps. It counts the days you spend in each country automatically, on your phone, and flags you as you approach thresholds like 183 days — so "how many days was I in Spain this year?" is a number you already have, not one you reconstruct from boarding passes and memory.

This is general information, not legal or tax advice. Rules vary by country and change — check the official Agencia Tributaria guidance and a qualified adviser for your situation.