Spain (Spanish: España ( listen)), officially the Kingdom of Spain (Spanish: Reino de España), is a country mostly located on the Iberian Peninsula in Europe. The country's 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. Spanish territory includes two large archipelagoes, the Balearic Islands in the Mediterranean Sea and the Canary Islands off the African Atlantic coast, two cities, Ceuta and Melilla, on the African mainland and several small islands in the Alboran Sea near the African coast. Spain is the only European country to have a border with an African country (Morocco).
With an area of 505,990 km2 (195,360 sq mi), 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 Sp(a)n or Spania. At the end of the Western Roman Empire the Germanic tribal confederations migrated from Central Europe, invaded the Iberian peninsula and established relatively independent realms in its western provinces, including the Sueves, Alans and Vandals. Eventually, the Visigoths would forcibly integrate all remaining independent territories in the peninsula, including Byzantine provinces, into the Kingdom of Toledo, which more or less unified politically, ecclesiastically and legally all the former Roman provinces or successor kingdoms of what was then documented as Hispania.
In the late eighth century the Visigothic kingdom fell to the Moors, who ruled most of the peninsula for the next seven centuries, leaving only a handful of small Christian realms in the north. Following the Moorish conquest, Europeans began a gradual process of retaking the region known as the Reconquista, which by the late 15th century culminated in the emergence of Spain as a unified country under the Catholic Monarchs. In the early modern period, Spain became one of history's first global empires, leaving a vast cultural and linguistic legacy that includes over 500 million Hispanophones, making Spanish the world's second most spoken native language, after Mandarin Chinese.
Spain is a secular parliamentary democracy and constitutional monarchy, with King Felipe VI as head of state. It is 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 (UN), the European Union (EU), the Eurozone, the Council of Europe (CoE), the Organization of Ibero-American States (OEI), the Union for the Mediterranean, the North Atlantic Treaty Organization (NATO), the Organisation for Economic Co-operation and Development (OECD), OSCE, the Schengen Area, the World Trade Organization (WTO) and many other international organisations. Spain has a "permanent invitation" to the G20 summits that occur generally once a year.