The salient line seems to be "if you move to Spain in the same year as you sell your house" so on that basis I don't think which way round you buy and sell will make any difference.
Posted: Mon Feb 24, 2020 1:28pm
Yes, buying a Spanish property then subsequently selling a UK one will attract CGT in Spain (assuming you are fiscally resident in Spain).
We have the same conundrum, so are in the process of selling our UK property now and plan to move to Spain in July, rent first, then buy next year to avoid CGT issues