Dear S. Blake,
If you become a resident in Spain, your beneficiaries will have to pay inheritance tax where the assets being bequeathed are located. But the same will happen if you stay a UK resident. Therefore, we must conclude that residency does not affect the jurisdiction where the tax is paid.
Yours sincerely