This is the tax identification number, required for anyone who makes cash transactions in Spain, that could have fiscal consequences , even theoretically. For example, this number is usually required to open a bank account. This number is provided by the Spanish police and thereafter registered automatically with the Spanish tax office (= hacienda). For Spaniards this number (número de identificación fiscal) is called N.I.F. and for foreigners N.I.E.(número de identificación extranjero).
N.I.E número de identificación de extranjeros
This is the identification number which foreigners who are resident, receive in Spain. Both N.I.F and N.I.E numbers actually have a similar function. (Residencia = residence permit).