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. The recession is spurring secessionist sentiment in Catalonia
- Economy: Spain was hit hard in the 2008-9 global economic crisis and is deep in recession. More than 27% of Spaniards are unemployed
- 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 Catalans won nation status within Spain and 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 Basque separatist group Eta has led to nearly 850 deaths over the past four decades.
Tentative moves to negotiate a lasting peace were dealt a blow when Eta carried out a deadly bomb attack at Madrid's international airport in 2006, but, after several stalled cease-fires, in 2012 it announced that it was ready to disband.
Until 2008, the Spanish economy was regarded as one of the most dynamic within the EU. However, the mainstays of the economy were tourism and a booming housing market and construction industry, and so the global economic crisis of 2008-9 hit the country hard.
The bursting of the housing bubble tipped Spain into a severe recession and by the end of 2011 the country had an unemployment rate of nearly 23% - then the highest jobless rate in Europe. By the spring of 2013 this had risen still further, to 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.
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.