Countries That Border Spain: 5 Neighboring Countries
Borders & Boundaries

Countries That Border Spain: 5 Neighboring Countries

Spain borders 5 countries on the Iberian Peninsula and beyond. Discover its frontiers with France, Portugal, Andorra, Morocco, and the British territory of Gibraltar.

Geography Worlds
March 26, 2026
4 min read

Spain shares land borders with 5 countries and territories: France (623 km), Portugal (1,214 km), Andorra (63.7 km), Morocco (18.5 km via the enclaves of Ceuta and Melilla), and Gibraltar/United Kingdom (1.2 km). Spain's total land boundary spans approximately 1,920 km across the Iberian Peninsula, the Pyrenees, and North Africa.

Introduction

Occupying most of the Iberian Peninsula in southwestern Europe, Spain's borders range from the soaring Pyrenees mountains along the French frontier to the flat plains of the Portuguese border and even extend to the African continent. Spain is unique among European nations in having land borders on two continents, with its North African enclaves of Ceuta and Melilla bordering Morocco. The tiny British Overseas Territory of Gibraltar at Spain's southern tip adds another layer of geopolitical complexity.

Countries That Border Spain: 5 Neighboring Countries
Countries That Border Spain: 5 Neighboring Countries | Source: Wikimedia Commons

Complete List of Countries Bordering Spain

  • Portugal: 1,214 km
  • France: 623 km
  • Andorra: 63.7 km
  • Morocco: 18.5 km (Ceuta: 8 km, Melilla: 10.5 km)
  • Gibraltar/United Kingdom: 1.2 km

Spain's borders reflect its position at the crossroads of Europe and Africa. The Portugal border is by far the longest, running the full length of western Iberia. The Pyrenees form a natural mountain barrier with France and tiny Andorra. Spain's African enclaves and Gibraltar make its border situation uniquely complex.

Western Border: Portugal

  • Border length: 1,214 km — one of the oldest borders in Europe
  • Key feature: The Guadiana and Minho rivers form natural boundary sections

The Spain-Portugal border, known as "A Raia" or "La Raya," stretches 1,214 km from the mouth of the Minho River in the north to the Guadiana River estuary in the south. It is one of the oldest established borders in Europe, largely unchanged since the Treaty of Alcañices in 1297. The border passes through varied landscapes including mountainous terrain in the north, the arid plains of Extremadura in the center, and the gentle hills of the Algarve in the south.

Despite being neighbors for over 700 years, Spain and Portugal have maintained distinct cultural identities. The border region on both sides has historically been one of the poorest areas of Western Europe. Today, both nations are EU and Schengen members, making the border freely crossable. The International Bridge over the Guadiana, opened in 1991, is one of the most important crossing points.

Northern Border: France and Andorra

  • France border: 623 km — defined by the Pyrenees mountain chain
  • Andorra border: 63.7 km — high mountain microstate in the eastern Pyrenees

The Pyrenees mountains create a dramatic natural border between Spain and France, running 623 km from the Bay of Biscay to the Mediterranean. The Treaty of the Pyrenees (1659) established this frontier, which follows the mountain watershed for most of its length. Key crossing points include the coastal passages at either end and mountain passes like Roncesvalles, famous from the medieval Song of Roland.

Andorra sits in the eastern Pyrenees, surrounded by Spain (63.7 km of border) and France. The microstate has historically been a buffer territory and remains a popular destination for duty-free shopping and skiing. Andorra is not part of the EU, making its borders with Spain among the few in Western Europe where customs checks still apply.

Southern Borders: Morocco and Gibraltar

  • Morocco (Ceuta): 8 km — Spanish enclave on the Moroccan Mediterranean coast
  • Morocco (Melilla): 10.5 km — Spanish enclave near the Algerian border
  • Gibraltar/UK: 1.2 km — British Overseas Territory at Spain's southern tip

Spain's borders with Morocco are unique in Europe. The cities of Ceuta and Melilla are Spanish sovereign territories on the North African coast, creating a total of 18.5 km of border with Morocco. These enclaves have been Spanish since the 15th and 16th centuries and represent the EU's only land borders with Africa. The borders are marked by high fences and are among the most heavily guarded frontiers in the world, as they represent a major migration route from Africa to Europe.

Gibraltar, a 6.7 km² British Overseas Territory, shares a 1.2 km border with Spain. The Rock of Gibraltar has been under British control since 1713 under the Treaty of Utrecht, but Spain has never fully relinquished its sovereignty claim. Following Brexit, Gibraltar's border status became a major diplomatic issue. The territory's 34,000 residents voted overwhelmingly to remain British in referendums in 1967 and 2002.

Historical Border Changes

Spain's borders have evolved significantly over the centuries. The Reconquista shaped the Iberian Peninsula's political map from the 8th to 15th centuries. Portugal's border with Spain solidified in the 13th century, making it one of Europe's most stable frontiers. Spain lost its last American and Pacific colonies in 1898 and granted independence to Spanish Sahara (now Western Sahara) in 1975 and Equatorial Guinea in 1968. Ceuta and Melilla remain contentious, with Morocco periodically asserting claims over the territories. Gibraltar has been a source of Anglo-Spanish tension for over three centuries.

Key Facts

  • Spain shares borders with 5 countries and territories on two continents
  • The Spain-Portugal border (1,214 km) has been largely unchanged since 1297
  • Ceuta and Melilla give Spain the EU's only land borders with Africa
  • Gibraltar's 1.2 km border with Spain is one of the shortest international boundaries in the world
  • The Pyrenees form a natural 623 km mountain barrier between Spain and France

Fun Facts

  • The Spanish town of Llívia is completely surrounded by French territory due to a quirk in the 1659 Treaty of the Pyrenees.
  • You can stand on the beach in Ceuta and see three countries: Spain (Ceuta itself), Morocco, and Gibraltar/UK across the strait.
  • The Spain-Portugal border is the longest uninterrupted border between any two EU countries.
  • Andorra has no airport, seaport, or railway — you can only enter by road from Spain or France.

Final Thoughts

Spain's borders tell a fascinating story of a nation at the crossroads of Europe and Africa. From the ancient frontier with Portugal to the contested enclaves of North Africa and the ongoing Gibraltar question, Spain's boundaries encompass some of the most historically significant and geopolitically complex borders in the world.

Test Your Knowledge!

Think you know your borders and boundaries? Try our interactive geography quiz!

Play Geography Games →