Royal Decree 338-1990 states that everyone, of whatever nationality, resident or not, who has any 'official business' in Spain, must have a fiscal number (NIF) which is used to identify them on all official documents.
The NIE/NIF number is a legal requirement in order to purchase or rent property, take out insurance, apply for loans or mortgages, make tax declarations and in connection with residencia/work permit applications. Also, it is required for entering into contracts for the supply of electricity, water etc.
The NIE and NIF are basically the same. The NIE is an identification document whilst the NIF is fiscal. The application procedure and the document issued are the same in both cases.
Application for the NIE number is through the National Police, Avenida Andalucia 3, Torre del Mar and the office is open Monday to Friday 9:00 - 14:00. Telephone number 95 296 50 85. Application forms can be obtained from your local National Police Station which will save a bit of time. The NIE takes 2 to 5 weeks to process and doesn't need renewing.
The following documents are required:
Passport + one of the following: title deed/rental contract/pre-contract for house purchase/ work contract/purchase contract of a vehicle/bank certificate of loan or mortgage/provisional insurance contract.
Non-resident taxpayers who own more than one property in Spain must appoint a fiscal representative in Spain to act on their behalf for dealings with the Spanish Tax Office (Delegacion de Hacienda).
The applicant must first go to the Spanish Consular office in their home country and present their passport, together with photocopies of all key pages, and these copies must then be certified by the consulate.
In Spain, the appointed fiscal representative must go to the police and present the certified photocopies together with a signed authorisation to act as the applicant's representative. Once issued, the NIF number must be used in all dealings with the Spanish Tax Office on behalf of the applicant.
Save yourself a bit of time, get the NIE application form HERE