Portuguese and Castilian forces halt a Marinid invasion at the Battle of Río Salado.

The Battle of Ro Salado also known as the Battle of Tarifa (30 October 1340) was a battle of the armies of King Afonso IV of Portugal and King Alfonso XI of Castile against those of Sultan Abu al-Hasan 'Ali of the Marinid dynasty and Yusuf I of Granada.

The Kingdom of Portugal (Latin: Regnum Portugalliae, Portuguese: Reino de Portugal) was a monarchy on the western part of Iberian Peninsula and the predecessor of the modern Portuguese Republic. Existing to various extents between 1139 and 1910, it was also known as the Kingdom of Portugal and the Algarves after 1415, and as the United Kingdom of Portugal, Brazil and the Algarves between 1815 and 1822. The name is also often applied to the Portuguese Empire, the realm's extensive overseas colonies.

The nucleus of the Portuguese state was the County of Portugal, established in the 9th century as part of the Reconquista, by Vímara Peres, a vassal of the King of Asturias. The county became part of the Kingdom of León in 1097, and the Counts of Portugal established themselves as rulers of an independent kingdom in the 12th century, following the battle of São Mamede. The kingdom was ruled by the Alfonsine Dynasty until the 1383–85 Crisis, after which the monarchy passed to the House of Aviz.

During the 15th and 16th century, Portuguese exploration established a vast colonial empire. From 1580 to 1640, the Kingdom of Portugal was in personal union with Habsburg Spain.

After the Portuguese Restoration War of 1640–1668, the kingdom passed to the House of Braganza and thereafter to the House of Braganza-Saxe-Coburg and Gotha. From this time, the influence of Portugal declined, but it remained a major power due to its most valuable colony, Brazil. After the independence of Brazil, Portugal sought to establish itself in Africa, but was ultimately forced to halt its expansion due to the 1890 British Ultimatum, eventually leading to the collapse of the monarchy in the 5 October 1910 revolution and the establishment of the First Portuguese Republic.

Portugal was an absolute monarchy before 1822. It alternated between absolute and constitutional monarchy from 1822 until 1834, and was a constitutional monarchy after 1834.