quality:corruption, information:classification, information:highlighting
Spain, formally the Kingdom of Spain, is a country in southwestern Europe with territories in North Africa. It is the largest country in Southern Europe and the fourth-most populous European Union member state. Spanning across the majority of the Iberian Peninsula, its territory also includes the Canary Islands in the Atlantic Ocean, the Balearic Islands in the Mediterranean Sea, and the autonomous cities of Ceuta and Melilla in Africa. Peninsular Spain is bordered to the north by France, Andorra, and the Bay of Biscay; to the east and south by the Mediterranean Sea and Gibraltar; and to the west by Portugal and the Atlantic Ocean. Spain's capital and largest city is Madrid, and other major urban areas include Barcelona, Valencia, and Zaragoza.

In early antiquity, the Iberian Peninsula was inhabited by Celts, Iberians, and other pre-Roman peoples. With the Roman conquest of the Iberian Peninsula, the province of Hispania was established. Following the Romanization and Christianization of Hispania, the fall of the Western Roman Empire ushered in the inward migration of tribes from Central Europe, including the Visigoths, who formed the Visigothic Kingdom centred on Toledo. In the early eighth century, most of the peninsula was invaded by the Umayyad Caliphate, and during early Islamic rule, Al-Andalus became a dominant peninsular power centred on Córdoba. Several Christian kingdoms emerged in Northern Iberia, chief among them Asturias, León, Castile, Aragon, Navarre, and Portugal; made an intermittent southward military expansion and repopulation, known as the Reconquista, repelling Islamic rule in Iberia, which culminated with the Christian seizure of the Nasrid Kingdom of Granada in 1492. The dynastic union of the Crown of Castile and the Crown of Aragon in 1479 under the Catholic Monarchs is often considered the de facto unification of Spain as a nation-state.

During the Age of Discovery, Spain pioneered the exploration of the New World, made the first circumnavigation of the globe and formed one of the largest empires in history. The Spanish empire reached a global scale and spread across all continents, underpinning the rise of a global trading system fueled primarily by precious metals. In the 18th century, the Bourbon reforms centralized mainland Spain. In the 19th century, after the Napoleonic occupation and the victorious Spanish War of independence, the following political divisions between liberals and absolutists led to the breakaway of most of the American colonies. These political divisions finally converged in the 20th century with the Spanish Civil War, giving rise to the Francoist dictatorship that lasted until 1975. With the restoration of democracy and its entry into the European Union, the country experienced an economic boom that profoundly transformed it socially and politically. Since the Siglo de Oro, Spanish art, architecture, music, poetry, painting, literature, and cuisine have been influential worldwide, particularly in Western Europe and the Americas. As a reflection of its large cultural wealth, Spain is the world's second-most visited country, has one of the world's largest numbers of World Heritage Sites, and it is the most popular destination for European students. Its cultural influence extends to over 600 million Hispanophones, making Spanish the world's second-most spoken native language and the world's most widely spoken Romance language.

Spain is a secular parliamentary democracy and a constitutional monarchy, with King Felipe VI as head of state. A developed country, it is a major advanced capitalist economy, with the world's fifteenth-largest economy by nominal GDP and the fifteenth-largest by PPP. Spain is a member of the United Nations, the European Union, the eurozone, North Atlantic Treaty Organization (NATO), a permanent guest of the G20, and is part of many other international organizations such as the Council of Europe (CoE), the Organization of Ibero-American States (OEI), the Union for the Mediterranean, the Organisation for Economic Co-operation and Development (OECD), the Organization for Security and Co-operation in Europe (OSCE), and the World Trade Organization (WTO).