It is the notario who is responsible to calculate the capital gains taxes due, retain them, and then pay them on your behalf.
If you have capital gains due, they will be paid to the notario at closing. If you are using escrow, the escrow company will transfer the funds to the notario. If not, then you will make a direct transfer to the notario.