There are a total of five countries that border Spain. Morocco, the United Kingdom, Portugal, Andorra and France all share a border with the Kingdom of Spain.
While France, Andorra and Portugal are the three official countries that border mainland Spain on the European continent, Spain does border the British territory of Gibraltar in the country's south and Gibraltar remains a point of contention between the United Kingdom and Spain. Nevertheless, the small territory is under British sovereignty.
Spain also possesses a small amount of territory on the African continent in the autonomous cities of Ceuta and Melilla, both of which border Morocco.