Spain (Spanish: España, [esˈpaɲa]), formally the Kingdom of Spain (Spanish: Reino de España), is a country in Southwestern Europe with some pockets of territory across the Strait of Gibraltar and the Atlantic Ocean. Its continental European territory is situated on the Iberian Peninsula. Its territory also includes two archipelagos: the Canary Islands off the coast of North Africa, and the Balearic Islands in the Mediterranean Sea. The African exclaves of Ceuta, Melilla, and Peñón de Vélez de la Gomera make Spain the only European country to have a physical border with an African country (Morocco). Several small islands in the Alboran Sea are also part of Spanish territory. The country's mainland is bordered to the south and east by the Mediterranean Sea; 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 respectively.
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 by area on the European continent. With a population exceeding 47.3 million, Spain is the sixth-most populous country in Europe, and the fourth-most populous country in the European Union. Spain's capital and largest city is Madrid; other major urban areas include Barcelona, Valencia, Seville, Zaragoza, Málaga, Murcia, Palma, Las Palmas de Gran Canaria and Bilbao.
Anatomically modern humans first arrived in the Iberian Peninsula around 42,000 years ago. Various cultures developed in the region with the migration and settlement of peoples including Phoenicians, Greeks, Celts and Carthaginians. The Romans had driven the Carthaginians out of the Iberian peninsula by 206 BC, and divided it into two administrative provinces, Hispania Ulterior and Hispania Citerior. Spain remained under Roman rule until the collapse of the Western Roman Empire in the fourth century, which ushered in Germanic tribal confederations from Central Europe. The Visigoths emerged as the dominant faction by the fifth century, with their kingdom spanning much of the peninsula.
In the early eighth century, the Visigothic Kingdom was conquered by the Umayyad Caliphate, ushering in over 700 years of Muslim rule. During this period, Islamic Spain became a major economic and intellectual center, with the city of Cordoba being among the largest and richest in Europe. Several Christian kingdoms emerged in the northern periphery of Iberia, chief among them León, Castile, Aragon, Portugal, and Navarre. Over the next seven centuries, an intermittent southward expansion of these kingdoms—metahistorically framed as a reconquest, or Reconquista—culminated with the Christian seizure of the last Muslim polity, the Nasrid Kingdom of Granada, in 1492. That same year, Christopher Columbus arrived in the New World on behalf of the Catholic Monarchs, whose dynastic union of Castile and Aragon is sometimes considered the emergent Spain as a unified country. From the 16th until the early 19th century, Spain ruled one of the largest empires in history, which was among the first global empires; its immense cultural and linguistic legacy includes over 570 million Hispanophones, making Spanish the world's second-most spoken native language. Spain hosts the world's third-largest number of UNESCO World Heritage Sites.
Spain is a secular parliamentary democracy and a parliamentary monarchy, with King Felipe VI as head of state. It is a highly developed country and a high income country, with the world's fourteenth-largest economy by nominal GDP and the sixteenth-largest by PPP. Spain 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), Organization for Security and Co-operation in Europe (OSCE), the Schengen Area, the World Trade Organization (WTO) and many other international organisations. While not an official member, Spain has a "Permanent Invitation" to the G20 summits, participating in every summit, which makes it a de facto member of the group.