The Spanish mainland is bordered to the south and east by the Mediterranean Sea except for a small land boundary with Gibraltar; to the north by France, Andorra, and the Bay of Biscay; and to the west by the Atlantic Ocean and Portugal. Spanish territory also includes the Balearic Islands in the Mediterranean, the Canary Islands in the Atlantic Ocean off the African coast, and two autonomous cities in North Africa, Ceuta and Melilla, that border Morocco. With an area of 504,030 km², Spain is the second largest country in Western Europe after France.
After serving as a granary of the Roman Empire, much of Spain was later conquered by a Muslim people, the Moors. Christian kingdoms gradually rolled back Muslim rule, completing this Reconquista in 1492. Spain became the leading world power, with a global empire on a scale and world distribution that had never been approached by its predecessors and a legacy today of over 400 million Spanish-speakers worldwide.
Napoleon‘s invasion of Spain in the early 19th century triggered independence movements that tore the empire apart and left the country politically unstable. In the 20th century it suffered a devastating civil war and came under the rule of a dictatorship, leading to years of stagnation. Democracy was restored in 1978 and the country has subsequently experienced a cultural renaissance and steady economic growth. Spain is now a constitutional monarchy organised as a parliamentary democracy and has been a member of the European Union since 1986, and NATO since 1982. It is a developed country with the eighth largest economy in the world based on nominal GDP.