Does Spain have a consulate in Dubai?
No. Spain's own foreign ministry confirms it is represented in the UAE by its Embassy in Abu Dhabi, with an economic and commercial office — not a consular office — in Dubai at Emirates Towers, Sheikh Zayed Road.
Consular services for Spanish nationals — passport renewal, birth and marriage registration, notarial acts — are handled through the Embassy in Abu Dhabi, by appointment.
If you've been told a "Spain Consulate in Dubai" handles document attestation directly, that's incorrect; no such office exists.