Of course the capital gain will be charged on the real profit of 100.000. You can prove you’ve spent the amount of 50.000 in building by showing all the invoices you’ve received and paid related to the building. Before selling the Villa it’s better to make the “Escritura de obra nueva”, where you go to the notary and with some Architect documents you can say that the cost of the building is 50.000. This Escritura is taxed at fixed rate of 1% on 50.000 (so, 500).
Just the very important thing. If you are non resident in Spain, you won’t be charged at a 15% rate. If the sale is considered a capital gain the rate for non resident people is 35%, if it’s considered parte of an economical activity you usually do the rate is 25%.
Sven, you can’t deduct your work as an expense even if you are builder. Notice that if you could deduct your work as an expense you’d give an income for the remuneration you’re supposed to receive for you work. So the same amount in expense and income is zero.
You’re going to be taxed at a 25% fixed rate on the profit of building and selling the villa.