Located at the crossroads of the Atlantic and the Mediterranean, Europe and Africa, Spain's history and culture are made up of a rich mix of diverse elements.
Through exploration and conquest, Spain became a world power in the 16th century, and it maintained a vast overseas empire until the early 19th century.
Spain's modern history is marked by the bitterly fought Spanish Civil War of 1936-39, and the ensuing 36-year dictatorship of General Francisco Franco.
After Franco's death in 1975, Spain made the transition to a democratic state and built a successful economy, with King Juan Carlos as head of state.
The constitution of 1978 enshrines respect for linguistic and cultural diversity within a united Spain. The country is divided into 17 regions which all have their own directly elected authorities. The level of autonomy afforded to each region is far from uniform. For example, Catalonia, the Basque Country and Galicia have special status with their own language and other rights.
At a glance
- Politics: PM Mariano Rajoy from the conservative Popular Party took office in late 2011. He faces secessionist sentiment in Catalonia
- Economy: Spain was hit hard in the 2008-9 global economic crisis, and has undertaken painful austerity measures. More than 27% of Spaniards were unemployed at lowest point
- International: Spanish forces have taken part in multilateral missions and peacekeeping, including in Afghanistan. Spain claims sovereignty over the British overseas territory of Gibraltar
Country profiles compiled by BBC Monitoring
Andalucia, Navarre, Valencia and the Canaries in turn have more extensive powers than some other regions. Asturias and Aragon have taken steps to consolidate language rights.
In 2006 a Catalan referendum backed by the central government gave the region greater autonomy.
The region's parliament gained extra powers in taxation and judicial matters, although the deepening recession and Catalonia's high indebtedness has spurred calls for independence from Spain. The country's regional picture is a complex and evolving one.
One of Spain's most serious domestic issues has been tension in the northern Basque region. A violent campaign by the armed Basque separatist group Eta led to nearly 850 deaths over four decades until, after several stalled cease-fires, it disbanded in 2012.
The Spanish economy was of the most dynamic in the EU, but the tourism, housing and construction industry mainstays were hit hard by the global economic crisis of 2008-9.
The bursting of the housing bubble tipped Spain into a severe recession and by the spring of 2013 unemployment had risen to a peak of 27.2%.
Austerity measures imposed by the government in an effort to reduce the level of public debt sparked a wave of protests and gave rise to the "Indignados" (the indignant ones) movement.
The economy nonetheless began to turn round by the end of 2013, and the country saw stronger than expected growth the following year, with unemployment falling back to 24.5%.
Spain consists of most of the Iberian peninsula, plus the Balearic Islands, the Canary Islands and two North African exclaves.
From Velazquez in the seventeenth century, through Goya straddling the eighteenth and nineteenth, to Picasso in the twentieth, Spain has the proudest of traditions in art.
Flamenco music and dance are widely admired around the world while Cervantes' novel Don Quixote is one of the most popular ever written.
Cinema is much loved and the films of directors such as Pedro Almodovar attract huge audiences.