Morocco is the only African country with a land border with Spain, because Spain’s territories of Ceuta, Melilla and Peñón de Vélez de la Gomera lie on or beside Morocco’s northern coast.
The Morocco–Spain land frontier is split into three separate sections rather than forming one continuous border. Together they total about 18.5 kilometres: approximately 8 kilometres around Ceuta, 10.5 kilometres around Melilla and a tiny 75-metre frontier at Peñón de Vélez de la Gomera. Spain also has maritime boundaries with Morocco in nearby waters.
A common mix-up is Western Sahara, which borders Morocco and is near Spain’s North African territories, but it is not generally treated as a sovereign country in this quiz context. The border also reflects centuries of history: Melilla came under Spanish control in 1497, while Ceuta was first conquered by Portugal in 1415 and later remained Spanish.