Spain , officially the Kingdom of Spain , is a sovereign state and a member state of the European Union. It is located on the Iberian Peninsula in southwestern Europe. 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 north east by France, Andorra, and the Bay of Biscay; and to
the west and northwest by Portugal and the Atlantic Ocean. It is one of three countries (Morocco, France) to have both Atlantic and Mediterranean coastlines. Spain's border with Portugal is the longest uninterrupted border within the European Union.
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, plus Alborán, Chafarinas Islands, Alhucemas, Vélez de la Gomera and other small islets including Perejil. Furthermore, the town of Llívia is a Spanish exclave situated inside French territory. With an area of , Spain is the second largest country in Western Europe and the European Union and the fifth largest country in Europe.
Modern humans first arrived in the Iberian peninsula around 35,000 years ago. It came under Roman rule around 200 BCE, after which the region was named Hispania. In the Middle Ages it was conquered by Germanic tribes and later by the Moors to the south. Spain emerged as a unified country in the 15th century, following the marriage of the Catholic Monarchs and the completion of the centuries-long reconquest, or Reconquista, of the peninsula from the Moors in 1492. Spain became an influential global empire in the early modern period, being one of the first countries to colonize the New World and leaving a legacy of over 500 million Spanish speakers today, making it the world's second most spoken first language.
Spain is a democracy organised in the form of a parliamentary government under a constitutional monarchy. It is a developed country with the thirteenth largest economy in the world by nominal GDP. Spain also has high living standards with the tenth-highest quality of life index rating in the world as of 2005. It is a member of the United Nations, NATO, OECD, and WTO.