Hi Amitia Wood,
You would pay tax in the country you are tax resident.
For a UK government pension these are normally still iable in the UK. if you are referring to a state pension then this can be exempt but you need to make a formal application for relief.
Please see guidance here:
Double Taxation: UK - Spain (Form Spain-Individual)