NIE is a tax number of a natural person, which is necessary for almost all legal actions in Spain.
NIF is the same as NIE for a natural person, and for a legal person NIF is a tax number.
CIF is the former name of NIF for legal person.