Update July 2019, several Trafico offices now offer ´Servicio Online´ where you can apply for the international licence online, with a digital certificate or Cl@ve, and pick up the licence from the Trafico office, without need for a prior appointment.
Further info and link to the DGT/Trafico electronic office. You can set the language to English with the Google translate option at the top right of the page.
If you hold a foreign licence in Spain, you need to register your licence first, before you can apply for an International Driving Licence. Info
Note: it says that you need to make a cita previa for ‘canje’ but I would suggest ‘tramite de oficina’ instead, as the waiting time for the latter is much shorter and you don’t want to exchange your EU licence for a Spanish one.
Note: you must be in possession of a valid EU driving licence to apply for an International Licence (if not Spanish – register first, see above) and you can only use it when driving a vehicle outside the EU.
Do you need an IDL when holding a Spanish driving permit, visiting the UK after 1.1.2021?