Temporary residence permit:
It is an authorization to stay in Spain for a period greater than 90 days and less than 5 years. It can be renewed, according to the circumstances that motivated the authorization. This is also usually called Non-Profit Residence
Long-term residence permit:
Authorizes to reside and work in Spain under the same conditions as Spaniards. It has several requirements. One of the assumptions is to have resided legally and continuously in Spanish territory for 5 years, although it is not the only one.