WhatsApp and email answered by the lawyer himself.Book a call

Mortgage and reinvestment

Reinvestment with a mortgage: can the Spanish exemption apply?

The outstanding capital of the loan that financed the home you sell is deducted from the amount to reinvest, and what you pay for the new home with borrowed money counts as reinvested. You do not need to repay the new loan with the proceeds of the sale.

By Jacob Salama, Main Home Reinvestment Lawyer · Málaga Bar 11.294Updated 30 November 20263 min read

1. A mortgage on the home you sell

Article 38.1 of the Income Tax Act requires the total amount obtained to be reinvested. Under article 41.1 of the Regulation, if you used external financing to acquire the home you are selling, that amount is the transfer value less the loan principal outstanding at the time of the sale. The transfer value is already net of the selling costs and taxes you bear. The DGT applies the rule in V2245-25.

Basic rule: transfer value €300,000, outstanding purchase loan €100,000: reinvesting €200,000 in the new main residence, in time, covers the full exemption.

Repaying the old loan is not in itself reinvestment. And a loan that did not finance the purchase of that home is not covered by the rule: see mortgage cancellation.

2. A mortgage on the home you buy

The Supreme Court, in judgment 1239/2020 of 1 October (appeal 1056/2019, CENDOJ), held that it is not necessary to use the money obtained from the sale and that it is enough to apply to the same purpose money borrowed from a third party. The TEAC follows that doctrine in ruling 00/01065/2021, of 27 May 2024, and the DGT in V0844-24: the amount reinvested is the whole acquisition value paid for the new home within two years before or after the sale, whether it was financed with a loan or with own funds.

So you do not have to repay the new mortgage with the sale proceeds. What matters is what you paid for the new home, when you paid it, and that it became your main residence within twelve months.

In judgment 508/2022, of 29 April (appeal 2554/2020, CENDOJ), the Supreme Court added that the amount reinvested may extend to loan amounts repaid after the two years.

3. Buying first with a loan and selling later

This is the most common situation. If the new home was acquired within the two years before the sale, what you paid for it counts, even if the bank lent you most of it.

Example. In 2025 you buy the new home for €300,000 with a €280,000 mortgage. In 2026 you sell the old one: transfer value €320,000, outstanding purchase loan €50,000, amount obtained €270,000. Because €300,000 was paid for the new home within the window, the exemption is full, whatever you do afterwards with the proceeds.

4. Proportional exemption with a mortgage

Article 41.4 exempts only the part of the gain that corresponds to the amount reinvested:

Exempt gain = total gain × (amount reinvested ÷ amount obtained after deducting the purchase loan)
Transfer value€350,000
Outstanding purchase loan€100,000
Amount obtained€250,000
Capital gain€200,000
Reinvested€180,000 (72 %)
Exempt / taxable gain€144,000 / €56,000
Tax on the taxable part1,140 + 9,240 + 1,380 = €11,760

Working out the percentage on the gross price would give a smaller exemption than the law allows.

5. The TEAC ruling of 20 October 2025 is about something else

TEAC 00/02995/2025 deals with the old mortgage deduction that survives for purchases before 2013 (eighteenth transitional provision of the Act): whether the capital repaid with the sale price can enter the base of that deduction. It does not change how the reinvestment exemption is calculated.

6. Evidence to keep when there is a loan

  • Both deeds, the loan deeds and the bank certificate of the capital outstanding on the date of sale.
  • Invoices for selling and purchase costs.
  • Proof of every payment for the new home, with dates, and of when you moved in.

Sources: article 38 of Law 35/2006 and article 41 of Royal Decree 439/2007 (BOE). Jacob Salama can check the figures before you file: contact us. Spanish version: reinversión con hipoteca.

Selling or buying with a mortgage

I still owe money on the home I am selling. Do I have to reinvest the full price?

No, if that loan financed its purchase. If your transfer value is €300,000 and you owe €100,000, the amount obtained for this purpose is €200,000 (article 41.1 of the Regulation).

Does paying off the old mortgage count as reinvestment?

No. It reduces the amount you need to reinvest, but only what goes into the new main residence counts as reinvested.

Must I use the sale proceeds to repay the loan on the new home?

No. In judgment 1239/2020 the Supreme Court held that borrowed money applied to the same purpose is enough, and the DGT treats as reinvested the whole acquisition value paid within the two-year window, however financed (V0844-24, V2245-25).

Do instalments paid after the two years count?

In its judgment of 29 April 2022 (appeal 2554/2020) the Supreme Court held that the amount reinvested may extend to loan amounts repaid later. The same money cannot be counted twice.

Jacob Salama

Jacob Salama

Main Home Reinvestment Lawyer · Málaga Bar 11.294

Member of the Málaga Bar (no. 11.294) and managing partner of SALAMA LEGAL, S.L.P. He advises individuals on Spanish income tax and cross-border taxation and reviews the content of this website himself.

About the lawyer (ES) · Book a call

Last reviewed: 30 November 2026. General information on Spanish law in force; it does not replace advice on your specific case.

Further reading

Talk to the lawyer

Before you sign the sale, let a lawyer check your exemption

One wrong date or figure can cost you the whole exemption. We review your case and tell you how much you can save.

Book a callWhatsAppContact form
Book a callWhatsApp