The NIE (Número de Identidad de Extranjero) 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 NIE does not expire and does not authorise you to reside or work.
The TIE is a physical card with a photo that proves you legally reside in Spain. It contains your printed NIE, but also the type of authorisation and validity dates. Everyone with a TIE has an NIE, but not everyone with an NIE has a TIE.