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.
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. 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.
Eta declared a ceasefire in March 2006 saying it wished to see the start of a democratic process for the Basque region. The move divided opinion in Spain.
Tentative moves to negotiate a lasting peace were dealt a blow when Eta carried out a deadly bomb attack at Madrid's international airport at the end of the year. In June 2007, Eta called off its ceasefire.
The group announced another ceasefire in September 2010, but this time, the government said it was not prepared to enter into negotiations unless Eta renounced violence for good.
International negotiators urged Eta to lay down its weapons at a conference in October 2011, seen as a possible prelude to Eta's dissolution. Neither the Spanish government nor Eta was officially represented.
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% - the highest jobless rate in Europe. Austerity measures imposed by the government in an effort to reduce the level of public debt sparked a wave of protests.
Spain shares the Iberian peninsula with Portugal and its territory includes the Balearic Islands, the Canary Islands and two North African enclaves.
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.
Head of state: King Juan Carlos I
Spaniards honour King Juan Carlos for ensuring the country's transition to democracy after the death of the former dictator, General Franco, and for saving Spain from a coup attempt in 1981.
Prime minister: Mariano Rajoy
Mariano Rajoy became prime minister in December 2011 after his conservative Popular Party won a resounding victory in parliamentary elections.
The election campaign was dominated by Spain's deep debt crisis and sky-high unemployment, and the governing Socialists' defeat was widely expected.
Mr Rajoy, who has long been known as a cautious public administrator, warned the Spanish people that there is no miracle cure to restore the country to economic health.
He has pledged to cut government spending by a total of 16.5bn euros (£13.7bn, $21.5bn) and to reduce the public deficit from about 8% to 4.4% of gross domestic product in 2012.
The son of a lawyer, Mariano Rajoy grew up in a socially conservative Catholic environment, studied law and began his career as a land registrar.
He became a regional deputy for the Popular Party at the age of 26 and rose steadily through the party ranks.
He held a number of ministerial positions in the governments of Jose Maria Aznar from 1996 to 2004, and was rewarded for his loyalty and discipline when Mr Aznar chose him as his successor as party leader.
As leader of the opposition after the 2004 election - which the Popular Party lost mainly on account of its handling of the aftermath of the Madrid train bombings - Mr Rajoy struggled to rebuild the party's fortunes.
His staying power finally paid dividends when the global economic downturn destroyed public faith in the Socialists' ability to steer the country through a period of deep crisis.
He is married, with two children, and is known to be a fan of cycling and the Real Madrid football team.
Broadcasting in Spain has witnessed a significant expansion in recent years with the emergence of new commercial operators and the launch of digital services.
The cable and satellite markets have grown and Spain completed the switchover to digital terrestrial TV (DTT) broadcasting in 2010.
Home-produced dramas, reality shows and long-running "telenovelas" are staple fare on primetime TV.
Public radio and TV are run by RadioTelevision Espanola (RTVE). As well as public and commercial national TV networks, there are 13 regional stations backed by regional governments and many local stations.
Multichannel TV is offered by the satellite platform Digital Plus.
There were 29.1 million internet users by June 2010, and more than 11 million Facebook users by August 2010 (Internetworldstats).