It can be done at a Consulate General in UK - slowly.
Depending on what part of UK you live in, you have to physically go there [London/Edinbugh/Manchester] with the documents required and £8
IN CASH. The Consulate then forwards it to the Police Station most appropriate for your destination in Spain and it is processed there. It takes "between 1-3 months", to quote the C.General info.
All this info can be had on the NIE page of the Spainish Consulate General. Here it is
Consulado de España en Londres
They also have a page of instructions on how to fill the in form EX-15, which is downloadable from the info page.
Bizarrely, they say "don't apply if you intend to live in Spain". However, they go on to say that you apply if "... as a foreign national, the reason for your request is economic, professional or social"
That seems to cover all bases, then. I think that stating your intention is to buy property in Spain
should have them turning your NIE round chop-chop but bureaucrats don't have their brains wired like normal people ...
Best of Luck