I found this and hope it is correct!
"For foreigners in Spain, the NIF (fiscal identity number) and NIE (identity number for foreigners) are interchangeable, because the numbers will be the same, while for Spanish nationals on the other hand the NIF refers to their DNI."
Bookmarks