It's normally cheaper to get your passport while you are visiting UK. You have to book and pay for premium service at regional passport office located in various cities. British consulate in Spain charge 143 euro plus courier fee, while same-day service in UK is £129.50 or £112.50 for a one-week service. If you apply within 9 months of your existing passport's expiry, you get the remaining validity added to your new passport.
Non-UK residents If you do not live in the UK, you can apply in person to renew your passport while visiting the UK. To do this you need to call the IPS Passport Adviceline on +44 (0)300 222 0000 to make an appointment at a Regional Passport Office. You must also provide an address in the UK to which IPS can post the new passport. IPS cannot accept applications from overseas. If you would like to renew your British Passport while living abroad, you will need to contact your local embassy, high commission or consulate. As it usually takes around four weeks to issue a passport overseas, you should not make travel plans during this time. You may also be asked to attend an interview. If you have any questions, please contact your local embassy, high commission or consulate.
I sent my passport off registered post to HMG Madrid, got it back by courrier a week later.
Can't remember what I paid but I worked out it was less than if I had flown to the UK and booked an appointment at the Passport Office in London.
If you are going to the UK anyway and staying for a few weeks it could be cheaper sending it via the ten day service or whatever it's called from the Post Office.
Assuming the postal workers' strike is settled, of course.....