The premise is inverted. Spain was never colonized in the early modern period—it was a colonizer.
From the 15th century, Spain established holdings in Africa:
Spain emerged from the Reconquista (completed 1492), unified under Ferdinand and Isabella. It built a global empire—Americas, Philippines, Africa—becoming the first “empire on which the sun never sets.”
Spain lost its last African territory (Western Sahara) in 1975. Today, Ceuta and Melilla remain Spanish ciudades autónomas—claimed by Morocco.
The question reverses colonizer and colonized. Spain projected power outward; it did not receive it.