NIE first: get this before anything else
The NIE is a 9-character identifier (letter + 7 digits + letter) issued by the Oficina de Extranjería. Every non-Spanish national who interacts with Spain materially has one. Without NIE you cannot register a long-term rental, sign a utility contract, open a resident bank account, register with Hacienda, or buy property.
Two routes to NIE: in Spain at a Police station or Extranjería office (the process takes 1-4 weeks depending on the city), or in the UK at the Spanish Consulate in London or Edinburgh (longer wait for appointments, 4-8 weeks typical). Most movers get NIE in Spain shortly after arrival, but the UK route is useful if you need NIE for a property purchase or visa stage before moving.
Once issued, NIE is permanent and never changes. Keep multiple printed copies — Spanish bureaucracy still runs on photocopies of identity documents.