Lying at the crossroads of the North and South American continents and the Atlantic and Pacific oceans, Panama is of immense strategic importance.
This has made Panama the frequent object of US attention. The United States supported its secession from Colombia in 1903, and secured a sovereign zone in which to build the Panama Canal - which remained under US control from 1914 until 1999.
The US invaded Panama in 1989 to depose a former ally, military ruler Manuel Noriega, over his repressive rule and use of the country as a centre for drug trafficking.
Panama has the largest rainforest in the Western Hemisphere outside the Amazon Basin.
However, it is for a feat of engineering, the canal connecting the Atlantic and Pacific oceans, that Panama is famous. Every year more than 15,000 vessels make the eight-hour journey through the waterway, which makes a substantial contribution to the country's economy.
Republic of Panama
Capital: Panama City
Population 3.6 million
Area 75,517 sq km (29,157 sq miles)
Major languages Spanish, English
Major religion Christianity
Life expectancy 74 years (men), 79 years (women)
President: Laurentio Cortizo
A former head of the National Assembly, Mr Cortizo won the 2019 presidential election for the centre-left Democratic Revolutionary Party, narrowly beating Rómulo Roux of the conservative Democratic Change party.
Press freedom is protected by the constitution and journalists work in relatively safe conditions.
Most media outlets are privately owned. There are no restrictions on internet access.
Some key dates in the history of Panama:
1502 - Spanish explorer Rodrigo de Bastidas visits Panama, which was home to Cuna, Choco, Guaymi and other indigenous peoples.
1519 - Panama becomes Spanish Vice-royalty of New Andalucia (later New Granada).
1821 - Panama becomes independent of Spain, but joins the confederacy of Gran Colombia, which also comprises Colombia, Venezuela, Ecuador, Peru and Bolivia.
1830 - Panama becomes part of Colombia following the collapse of Gran Colombia.
1880s - France attempts to build a canal linking the Atlantic and Pacific oceans, but fails due to financial difficulties and the death of more than 20,000 workers from tropical diseases.
1903 - Panama splits from Colombia and becomes fully independent. US buys rights to build Panama Canal and is given control of the Canal Zone in perpetuity. The canal is completed in 1914.
1968-1989 - Period of military rule.
1989 - US invades and ousts Gen Manuel Noriega who became de facto ruler of Panama as head of defence forces in 1983.
1991 - Parliament approves constitutional reforms, including abolition of standing army.
1999 - Panama takes full control of the Panama Canal, ending nearly a century of American jurisdiction over one of the world's most strategic waterways.
2016 - "Panama Papers" lift lid on how the rich and powerful use tax havens to hide their wealth, and reveal Panama itself as one of most popular tax havens.