Did you realise that the UK government has made major changes to the passport and consular service for British Nationals who are overseas?
Before, you had to make the application directly to the British Consular Service in the country you were living in at the time, which in Spain’s case, was in Madrid. That is no longer how it works.
Since the middle of 2014 all passport applications are now controlled directly from within the UK. All passports are also issued from the UK, so you can only renew your passport online.