Portugal (Portuguese: [puɾtuˈɣal]), officially the Portuguese Republic (Portuguese: República Portuguesa [ʁɛˈpuβlikɐ puɾtuˈɣezɐ]), is a country located mostly on the Iberian Peninsula in southwestern Europe. It is the westernmost sovereign state of mainland Europe, being bordered to the west and south by the Atlantic Ocean and to the north and east by Spain. Its territory also includes the Atlantic archipelagos of the Azores and Madeira, both autonomous regions with their own regional governments.
Portugal is the oldest nation state on the Iberian Peninsula and one of the oldest in Europe and the world, its territory having been continuously settled, invaded and fought over since prehistoric times. The pre-Celtic people, Iberians, Celts, Carthaginians and Romans were followed by the invasions of the Visigoths and Suebi Germanic peoples. After the Muslim conquests of the Iberian Peninsula, most of the territory was part of Al-Andalus for several centuries. Portugal as a country was established during the early Christian Reconquista. Founded in 868, the County of Portugal gained prominence after the Battle of São Mamede in 1128. The Kingdom of Portugal was later proclaimed following the Battle of Ourique in 1139, and independence from León was recognised by the Treaty of Zamora in 1143.
In the 15th and 16th centuries, Portugal established the first global empire, becoming one of the world's major economic, political and military powers. During this period, today referred to as the Age of Discovery, Portuguese explorers pioneered maritime exploration, notably under royal patronage of Prince Henry the Navigator and King John II, with such notable voyages as Bartolomeu Dias' sailing beyond the Cape of Good Hope (1488), Vasco da Gama's discovery of the sea route to India (1497–98) and the European discovery of Brazil (1500). During this time Portugal monopolized the spice trade, divided the world into hemispheres of dominion with Castille, and the empire expanded with military campaigns in Asia. However, events such as the 1755 Lisbon earthquake, the country's occupation during the Napoleonic Wars, the independence of Brazil (1822), and a late industrialization compared to other European powers, erased to a great extent Portugal's prior opulence.
After the 1910 revolution deposed the monarchy, the democratic but unstable Portuguese First Republic was established, later being superseded by the Estado Novo authoritarian regime. Democracy was restored after the Carnation Revolution in 1974, ending the Portuguese Colonial War. Shortly after, independence was granted to almost all its overseas territories. The handover of Macau to China in 1999 marked the end of what can be considered the longest-lived colonial empire.
Portugal has left a profound cultural, architectural and linguistic influence across the globe, with a legacy of around 250 million Portuguese speakers, and many Portuguese-based creoles. It is a developed country with an advanced economy and high living standards, which ranks 41st on the Human Development Index. Additionally, it is highly placed in rankings of moral freedom (2nd), peacefulness (3rd), democracy (8th), press freedom (12th), stability (15th), social progress (18th), prosperity (24th), and LGBT rights (7th in Europe). A member of the United Nations and the European Union, Portugal was also one of the founding members of NATO, the eurozone, the OECD, and the Community of Portuguese Language Countries.