Spain is located on the Iberian Peninsula in Europe. The African continent is separated from Europe by the Strait of Gibraltar.
The closest African country to Western Spain is Morocco, which is located across the Strait of Gibraltar.