The NIE (Número de Identidad de Extranjero) is the tax identification number that Spain assigns to any foreign person who needs to carry out a financial or legal transaction in the country. It is issued by the Dirección General de la Policía (National Police).
You need it to: buy or sell property, sign an employment contract, open a bank account, accept an inheritance, set up a company, or pay taxes. It is not a residence permit and does not authorise you to work.