Claim: Spain shares a border with Morocco.

Spain -LRB- España -LSB- esˈpaɲa -RSB- -RRB- , officially the Kingdom of Spain -LRB- -LSB- Reino de España , links = no -RSB- -RRB- , is a sovereign state located on the Iberian Peninsula in southwestern Europe , with two large archipelagoes , the Balearic Islands in the Mediterranean Sea and the Canary Islands off the North African Atlantic coast , two cities Ceuta and Melilla in the North African mainland and several small islands in the Alboran Sea near the Moroccan coast . Its mainland is bordered to the south and east by the Mediterranean Sea except for a small land boundary with Gibraltar ; to the north and northeast by France , Andorra , and the Bay of Biscay ; and to the west and northwest by Portugal and the Atlantic Ocean . It is the only European country to have a border with an African country -LRB- Morocco -RRB- and its African territory accounts for nearly 5 % of its population , mostly in the Canary Islands but also in Ceuta and Melilla .   With an area of 505990 km2 , Spain is the largest country in Southern Europe , the second largest country in Western Europe and the European Union , and the fourth largest country in the European continent . By population , Spain is the sixth largest in Europe and the fifth in the European Union . Spain 's capital and largest city is Madrid ; other major urban areas include Barcelona , Valencia , Seville , Bilbao and Málaga .   Modern humans first arrived in the Iberian Peninsula around 35,000 years ago . Iberian cultures along with ancient Phoenician , Greek and Carthaginian settlements developed on the peninsula until it came under Roman rule around 200 BCE , after which the region was named Hispania , based on the earlier Phoenician name Span or Spania . In the Middle Ages , the area was conquered by Germanic tribes and later by the Moors . Spain emerged as a unified country in the 15th century , following the marriage of the Catholic Monarchs and the completion of the eight centuries-long reconquest , or Reconquista from the Moors in 1492 . In the early modern period , Spain became one of history 's first global colonial empires , leaving a vast cultural and linguistic legacy that includes over 500 million Spanish speakers , making Spanish the world 's second most spoken first language , after Mandarin Chinese .   Spain is a democracy organised in the form of a parliamentary government under a constitutional monarchy . It is a middle power and a major developed country with the world 's fourteenth largest economy by nominal GDP and sixteenth largest by purchasing power parity . It is a member of the United Nations -LRB- UN -RRB- , the European Union -LRB- EU -RRB- , the Eurozone , the Council of Europe -LRB- CoE -RRB- , the Organization of Ibero-American States -LRB- OEI -RRB- , the North Atlantic Treaty Organization -LRB- NATO -RRB- , the Organisation for Economic Co-operation and Development -LRB- OECD -RRB- , the World Trade Organization -LRB- WTO -RRB- and many other international organisations .