It’s a bit complicated. You will need to consult a tax advisor – you could try blevinsfranks.com. Basically you pay inheritance tax if the property is in Spain, or the deceased is tax resident in Spain. But there are lots of exemptions. Tax rates vary according to circumstances. Only way round IHT to my knowledge is to own through an offshore company, but that has other costs and some risks.
Mark