In short: Spain and Morocco have a driving-licence exchange agreement (in force since 2004, updated in 2024), so you can swap your Moroccan licence for a Spanish one without an exam for cars and motorbikes. You must be a resident, have a valid licence, and do it within 6 months of gaining residency.
In person or by representative? The application is online at the DGT electronic office (with a digital certificate, or via a gestor with authorisation); but the medical fitness test (psicofísico) is in person at an authorised driver assessment centre (CRC).
The exchange applies to motorbike and car licences (A1, A, B) with no tests; truck or bus (C, D) need a practical test. Your Moroccan licence is only valid to drive in Spain for 6 months from when you gain normal residency; after that you must have started the exchange. Documents: valid residence authorisation (TIE/NIE) or ID/passport; original, valid Moroccan licence (surrendered to the DGT); proof of your residence in Spain; proof that you were not resident in Spain when you obtained the licence; and a medical fitness report (psicofísico) from a CRC (valid 90 days). The fee is tariff 2.3 (€28.87 in 2026 for A1/A/B). The procedure has been digital since 2024: once the DGT approves it, you get the Spanish licence (a provisional one immediately; the final one in ~1.5 months).
Steps:
- Gather the documents: valid residence, original Moroccan licence, proof of address in Spain and proof you didn't reside here when you got the licence.
- Pass the psicofísico at a driver assessment centre (CRC) (they also take your photo).
- File the exchange application at the DGT electronic office with a digital certificate and pay tariff 2.3.
- Surrender the original Moroccan licence; receive the provisional licence and, after the decision, the final one.
Official source: DGT — Exchange of Moroccan licences and DGT — Countries with exchange agreements. Informational only; check the official source and a professional for your specific case.