If you are already in Spain,
you can show up in person at the Foreigners Office at the police station and stand in line for a NIE. The address is Rambla de Guipuscoa 74 in Barcelona.
There are four steps in the application process for the NIE:
Making an appointment: You need an appointment (cita previa) for the Oficina de Extranjeros. You can get this here. Click on ‘Barcelona’ then ‘Certificados EU’.
Fill a NIE application form that can be found here:
For non-EU citizens, proof of legal entry into Spain and two passport photos will be needed;
Assuming all your forms are correctly filled in and you have the correct documentation, you will be given a pay slip, which must be taken to a bank to pay for the associated taxes (around €10).
Be aware, however, that many banks will only deal with this transaction between 8.30am and 10.30am, so be prepared to either get to the Foreigners’ Office early or complete the process over two days. Once paid, you must take your stamped slip back to the office, where you will be able to process your NIE. You will be given the number but will have to return in approximately one week to pick up the official paper.