If you sell a Costa del Sol property that is your vivienda habitual (habitual residence) and put the money into another main home, the capital gain can be fully or partly exempt from Spanish income tax under the reinvestment relief in the Ley 35/2006 del IRPF, but only if you are a tax resident and the home genuinely qualifies as your main residence. This matters when you buy, not just when you sell: the day you complete, you start building the occupancy record (minimum three continuous years) that the Agencia Tributaria will one day want to see. This article explains the three tests that decide whether your Costa del Sol home counts as your vivienda habitual in 2026, and how expats secure the exemption.
It is a relief in the Spanish personal income tax (IRPF) that lets a tax resident avoid paying capital gains tax on the profit from selling their main home, provided the sale proceeds are reinvested into a new main home within a set window. If you reinvest the entire amount you received from the sale, 100% of the gain is exempt; if you reinvest only part, the exemption is proportional to the fraction reinvested. The rule lives in the Ley 35/2006 del IRPF and its regulation (Reglamento del IRPF, Real Decreto 439/2007).
Crucially this is a residents' relief. It is not the same as the non-resident route, where sellers face the 3% retention withheld at the notary and reclaim overpayments later, we cover that in our guide on the 3% retention and how non-residents reclaim it. To use the vivienda habitual exemption, you must be able to prove to the Agencia Tributaria that you lived in Spain as a tax resident and that the home was your base.
You are a Spanish tax resident in a given year if you spend more than 183 days in Spain during the calendar year, or if your main economic interests or your spouse and dependent children are based here. This is the test in Article 9 of the Ley 35/2006 del IRPF. Residency is decided per calendar year, there is no half-year status, so a buyer who completes in, say, September will usually only become resident the following full year.
Being "resident" for immigration purposes (a TIE card, or an EU registration certificate) is not the same as tax residency, though in practice they overlap. If you spend most of the year in your Marbella or Estepona home and little elsewhere, you are almost certainly a Spanish tax resident and must file. New arrivals considering the flat-rate special regime should read our piece on the Beckham Law and who qualifies, note that Beckham Law taxpayers are taxed as non-residents and generally cannot use the vivienda habitual reinvestment relief.
Three conditions must be met for the Agencia Tributaria to accept a Costa del Sol home as your habitual residence under the Reglamento del IRPF (RD 439/2007):
A holiday home you visit for a few weeks does not qualify, however much you love it. If a Costa del Sol property is empty most of the year it is a second home, and you pay imputed rental income tax via Modelo 210 instead of enjoying a residents' exemption.
If you sell your main home as a resident and buy another main home, the gain is exempt to the extent that you reinvest the sale proceeds. The reinvestment can happen in a window that runs from two years before to two years after the sale, so you may buy the new home first and sell the old one afterwards. You also keep the exemption if you build or substantially renovate the new main home, provided the works complete within the deadlines in the Reglamento del IRPF.
One common trap: if your old home still carries a mortgage, the "amount reinvested" is the net proceeds after cancelling that loan, not the gross price. So the proceeds you must plough into the new home are what actually reaches your bank account. You declare the reinvested gain as exempt on your annual Modelo 100 (IRPF declaration), the June deadline following the year of sale.
| Situation | Who | Capital gains on the main home gain |
|---|---|---|
| Tax resident, sells vivienda habitual, reinvests 100% in a new main home | Resident expat relocating within the Costas | Fully exempt (Ley 35/2006) |
| Tax resident, reinvests only part of the proceeds | Resident downsizing | Exempt in proportion to the amount reinvested |
| Tax resident aged 65+ selling their vivienda habitual | Retired resident | Fully exempt, no reinvestment needed |
| Non-resident selling a second home | Overseas owner | Taxable; 3% retained at notary, reclaim via Modelo 210 |
Yes, and it is more generous. A tax resident aged 65 or over who sells their vivienda habitual pays no capital gains tax at all, with no obligation to reinvest the money. They can keep the cash, give it to their children, or buy a smaller place. This is a separate relief within the Ley 35/2006 del IRPF and it is one of the most valuable tools for older sellers. We go into it further, alongside reinvestment relief, in our dedicated guide on reinvestment relief and over-65 exemptions for Costa del Sol sellers.
There is also an over-65 relief on gains from selling other assets (not the main home) where the proceeds buy a life annuity, capped at €240,000, but that is a different mechanism and the paperwork is strict.
Because the clock starts on your completion day. To one day claim the exemption on this home, you need a clean record showing it was genuinely your main residence for at least three years. Practically, that means from the moment you complete on your Costa del Sol purchase you should:
Those same receipts matter whichever home you eventually sell; our list of deductible expenses to keep applies across all four Costas. And if your plan is simply to sell one Spanish home to fund another, see our guide to capital gains deferral when moving between the four Costas.
The exemption is about the eventual sale, but the purchase sets your acquisition cost. On the Costa del Sol (Andalucía) a resale pays ITP transfer tax of 7%, the lowest of our four regions, on the higher of the price paid or the cadastral valor de referencia set by the Catastro. A new build pays 10% IVA plus 1.2% AJD stamp duty in Andalucía. Add notary (~0.2-0.5%), land registry (~0.1-0.25%), a lawyer (~1% + IVA) and a gestoría (~€300). As a rule of thumb, budget around 10-13% on top of a resale price and 12-15% on a new build, with Andalucía at the lower end of both.
For the full regional picture see our breakdown of resale ITP rates across the Costa Blanca, Cálida, del Sol and Almería. By comparison, a Costa Blanca resale (C. Valenciana) pays 9% from 1 June 2026, the Costa Cálida (Murcia) pays 7.75%, and the Costa Almería (Andalucía) matches the Costa del Sol at 7%.
Across Mediter's current Costa del Sol stock, prices span a wide range, from apartments suited to a modest main-home budget up to substantial villas. That spread matters for the exemption: if you downsize from a larger villa to a smaller apartment and do not reinvest the full proceeds, your exemption is only proportional to the amount you plough back in. Buyers planning to make a Costa del Sol home their genuine primary residence should model the figures before committing, because whether a property is a main home or a second home changes the entire tax treatment on a future sale.
Thorough due diligence before you buy avoids most of these; our pre-purchase legal due diligence checklist is a good starting point for any of the four Costas.
To be fully exempt you must reinvest the entire net proceeds (after cancelling any mortgage) into a new main home within the two-year window set by the Reglamento del IRPF. Reinvest only part, and the exemption applies proportionally to the fraction you reinvest.
At least three continuous years, having moved in within 12 months of completion. Selling earlier for a recognised reason, a job relocation, marriage or separation, can still preserve the status under the Reglamento del IRPF (RD 439/2007).
No. The vivienda habitual reinvestment relief is only for Spanish tax residents filing Modelo 100. Non-residents selling a Costa del Sol home face the standard capital gains rules with the 3% retention at the notary, reclaimed via Modelo 210 if overpaid.
For the main home, yes, a resident aged 65 or over who sells their vivienda habitual pays no capital gains tax and does not need to reinvest, under the Ley 35/2006 del IRPF. The home must still genuinely be their habitual residence.
Your empadronamiento at the town hall, utility bills and consumption in your name, the address on your resident tax return, and your family's presence there. The Agencia Tributaria looks at the whole picture, not a single document.
Yes. Taxpayers under the special expat regime (Beckham Law) are taxed as non-residents and generally cannot claim the vivienda habitual reinvestment relief, so weigh the regimes carefully before applying.
Whether a Costa del Sol property becomes your genuine main residence or a holiday base changes everything about your future tax bill, and the decisions you make on completion day matter years later. The team at Mediter Real Estate helps international buyers find the right home across the Costa del Sol, Costa Blanca, Costa Cálida and Costa Almería, and works alongside trusted local lawyers and tax advisers. Contact Mediter Real Estate today to talk through your plans and view property that fits your residency goals.
To, co nam tu napiszesz, wykorzystamy wyłącznie do odpowiedzi. Privacy
Używamy plików cookie niezbędnych do działania strony. Za Twoją zgodą używamy też plików cookie Meta (Facebook), aby mierzyć nasze reklamy i pokazywać Ci nieruchomości podobne do tych, które oglądałeś. Pliki cookie Google Analytics, również tylko za Twoją zgodą, liczą odwiedziny i pokazują nam, które strony pomagają.
Polityka cookie