Also in case of sale you have to distinguish between the resident seller, and the non-resident seller.
For non-resident seller the buyer is obliged to retain 3% of the sales/purchase price, this retention has to be paid to the tax office on account of the benefit tax of the seller. The seller after that has to present a tax return declaring the real benefit. This real benefit will be calculated deducting from the sales price, in the first place the original purchase price, and after that deducting any costs made for example renewing the property, transfer tax paid at the moment of purchase, etc. On the result of this calculation a formula will be applied for the devaluation of the property, reducing it a bit more. The non-resident seller will have to pay after that 24,75% (at least at this moment, may 2014, the government can change the percentage in the future), on this benefit, the 3% retained previously by the buyer will be deducted from this amount. In case the seller has had no benefit or the 3% retained is too much, the seller can apply for the money to be returned.
In case you have renewed the property but you have not included this renewal in the property register (by the “ampliación de escritura de obra nueva”), you should do this before signing any sales deed. This can be used to update the value of the property, and so pay less benefit tax afterwards.
As a resident if you sell your property, if you are over 65 years old and you have lived there for more than 3 years, no benefit tax is due. If not, the sale has to be declared in your normal income tax form, and the benefit will be taxed accordingly. But as a resident in case you reinvest the money within two years after the sale in another property, the reinvested amount will not be taxed.