Spain country profile
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.
Kingdom of Spain
Population 46.7 million
Area 505,988 sq km (195,363 sq miles)
Languages Spanish (Castilian), Catalan and its variant Valencian, Gallego (Galician), Euskera (Basque)
Major religion Christianity
Life expectancy 79 years (men), 85 years (women)
Head of state: King Felipe VI
King Felipe succeeded to the throne on the abdication of his father Juan Carlos in June 2014. Born in 1968 when his father was heir-apparent to the vacant throne during the Franco dictatorship, Prince Felipe was educated for his future royal role, and undertook official engagements on behalf of the king from 1995.
Despite retaining considerable constitutional power as chief executive and commander-in-chief, King Felipe has pledged to continue his father's legacy of supporting the primacy of parliament.
Prime Minister: Pedro Sanchez
Pedro Sanchez took over as prime minister in June 2018, after his predecessor, Mariano Rajoy, lost a parliamentary confidence vote triggered by a long-running corruption trial involving members of his party.
Mr Sanches, head of the Socialist party, is Spain's seventh prime minister since its return to democracy in the late 1970s following the dictatorship of Francisco Franco.
Public broadcaster RTVE shares the market with major commercial operators. Regional TV networks are operated by their respective governments.
Freedom House NGO raises concerns about the concentration of media ownership and what it says is political interference in public media.
There are more than 40 million internet users. Facebook is the leading social platform.
- Read full media profile
Some key dates in Spain's history:
16th-17th centuries - Spanish Empire at its height, with Spain the predominant European power. The rise of Protestant states in northern Europe and the Ottoman Empire in the Mediterranean begin the country's gradual decline.
18th century - The War of the Spanish Succession loses Spain its European possessions outside the Iberian Peninsula. Bourbon dynasty, originally from France, centralises the Spanish state, shutting down many regional autonomous assemblies and modernising government and the military.
1807-1814 - Napoleon's France occupies Spain, which has been a French satellite since 1795. Fierce nationalist resistance and British intervention in the Peninsular War gradually force French troops out.
19th century - Napoleonic legacy of political division and economic dislocation leaves Spain weak and unstable, with frequent changes of government and a low-level insurgency by Carlist supporters of a rival branch of the royal family. All Latin American colonies win their independence, with Cuba, Puerto Rico and the Philippines in Asia lost during a disastrous war with the United States in 1898.
1936-39 - Spanish Civil War pits left-wing Republicans against right-wing Nationalists, with both sides receiving foreign support. General Francisco Franco leads the Nationalists to victory and remains in power till his death in 1975.
1939-45 - Spain remains neutral throughout the Second World War, although the government's sympathies clearly lie with the Axis powers.
1975 - Franco dies. Succeeded as head of state by King Juan Carlos. With Juan Carlos on the throne, Spain makes transition from dictatorship to democracy. Spain withdraws from the Spanish Sahara, ending its colonial empire.
1978 - New constitution confirms Spain as a parliamentary monarchy.
- Read full timeline