Spanish capital gains tax is a tax on the profit made from the sale of a property in Spain. The amount that is liable to be taxed is the profit, or increased difference between what you originally brought it for and what you ended up selling it for.
The actual amount that is taxable is only the profits made from the sale of the property after you have deducted buying and selling costs. The way that you pay this tax is through your annual tax returns. When you are going to do your self-assessed Spanish tax return declarations, there is a section designated to the profit or loss of selling assets, where in the case of selling you will fill in. You will need to declare any money made from the sale that is after taking off the costs. There are some tax reductions for residents if the money gained from the sale is to go back in to another property. Depending on the price of the new property will depend on the amount of profit that is taxable through capital gains. I you where to buy a house below the value of the previous property you have just sold, then it is assumed that part of the profits you made from the sale made be re-invested in to the new property and therefore the amount of profit that is taxable is reduced. The same can be said when you purchase a property at around the same or higher price as the one you have just sold. It can be assumed that you would need to re-invest most if not all the earnings back into to property, which means that there was little profit made and therefore little to tax. This is all down to that when someone purchase a property in Spain have pay various taxes upon purchase and therefore this is also taken into consideration when doing your personal taxes.
The exact percentages would need to be calculated by a professional who knows how and is up to date with any current changes in taxation. It is always a good idea to consult a qualified accountant with experience, such as those forming ABADs professional team, to clarify all aspects, before submitting your taxes returns to include capital gains tax.