The NIE is a tax identification number. It is assigned to any foreigner who needs it for a transaction in Spain, whether or not they live in the country.
The TIE (Tarjeta de Identidad de Extranjero) is a physical document, a card with a photo that proves you legally reside in Spain. All foreign residents have an NIE, but not everyone with an NIE is a resident or holds a TIE. The NIE does not authorise you to reside or work.