You can go in person to your nearest Spanish Consulate to apply for an NIE (Número de Identificación de Extranjero)
In order to open a bank account, purchase a property, buy a car, etc in Spain, you need an NIE number.
You can apply for an NIE number at your nearest Spanish Consulate. Here you could find out which one is closer to your location.
By clicking on the relevant country/flag below the map, you can find the contact details of any Consular Office. In some cases, specific instructions to obtain an NIE appointment and the documentation required are also readily available on the Consulate's page itself. To display the page in English, use the language toggle button at the top.