Mexico: it's your home, not your day count
Under Mexico's Código Fiscal de la Federación (Art. 9), you're a tax resident when your casa habitación — your home — is in Mexico. There is no 183-day rule for individuals at all. If you have a home only in Mexico, you're resident, full stop, no matter how many days you were physically there.
The Mexican-national presumption
If you're a Mexican national, the law presumes you're resident unless you can prove residence in another country. And when you do leave for good, you're supposed to file an aviso (notice) with the SAT within 15 days of ceasing residency. Skipping the aviso doesn't preserve or lose residency by itself — residency is a factual matter — but it's a compliance step people forget.
Spain: three doors, any one opens
Spain's IRPF law (Art. 9) makes you a tax resident if any one of three tests is met — you don't need all three:
1. More than 183 days in Spanish territory during the calendar year. Crucially, sporadic absences count toward the 183 unless you can prove tax residence in another country — so a few trips abroad don't reset the clock.
2. Economic base. If the main nucleus or base of your economic activities or interests is in Spain — directly or indirectly — you're resident even with far fewer than 183 days.
3. Family presumption. If your non-legally-separated spouse and dependent minor children habitually live in Spain, you're presumed resident (rebuttable with proof).
The Beckham option
New arrivals to Spain who become resident may be able to elect the "Beckham" regime (Art. 93), taxing only Spanish-source income at non-resident rates for up to six years. It's a valuable option for inbound workers and digital nomads, but it's an election with conditions — worth checking before your first Spanish tax year.
What if both countries claim you?
If you're resident of both Mexico and Spain under their domestic rules, the Spain–Mexico tax treaty breaks the tie in a set order: permanent home available → center of vital interests → habitual abode → nationality → mutual agreement between the two tax authorities. You won't be doubly taxed with no relief, but a dual-residency year is exactly when you want professional advice.
Check your likely status → Free checker: answer a few questions for Mexico or Spain and see which tests apply to you and your likely residency for 2026.