The War of the Portuguese Succession, a result of the extinction of the Portuguese royal line after the Battle of Alcácer Quibir and the ensuing Portuguese succession crisis of 1580, was fought from 1580 to 1583 between the two main claimants to the Portuguese throne: António, Prior of Crato, proclaimed in several towns as King of Portugal, and his first cousin Philip II of Spain, who eventually succeeded in claiming the crown, reigning as Philip I of Portugal.
The Cardinal Henry, great-uncle of Sebastian I of Portugal, became ruler in the immediate wake of Sebastian's death. Henry had served as regent for Sebastian after 1557, and succeeded him as King after the disastrous Battle of Alcácer Quibir in 1578. Henry renounced his clerical offices and sought to take a bride for the continuation of the Aviz dynasty, but Pope Gregory XIII, affiliated with the Habsburgs, did not release him from his vows. The Cardinal-King died two years later, without having appointed a Council of Regency to choose a successor.
Portuguese nobility was worried about the maintenance of their independence and sought help to find a new King. By this time the Portuguese throne was disputed by several claimants; among them were Catherine, Duchess of Braganza (1540-1614), her nephew Ranuccio I Farnese, Duke of Parma, Philip II of Spain and António, Prior of Crato. The Duchess was later acknowledged by the Habsburgs as the legitimate heir, after her descendants obtained the throne in 1640 (in the person of John IV of Portugal), but at that time, she was only one of several possible heirs. According to the feudal custom, her late older sister's son Ranuccio, an Italian, was the closest heir, then the Duchess herself, and only after them, King Philip. Philip II of Spain was a foreigner (although his mother was Portuguese) and descended from Manuel I by a female line; as for António, although he was Manuel I's grandson in the male line, he was an illegitimate grandson.
Ranuccio Farnese (1569-1622), the hereditary Duke of Parma and Piacenza, was the son of the late elder daughter of Duarte of Portugal, Duke of Guimarães, the only son of Manuel I whose legitimate descendants survived at that time, Ranuccio was according to the feudal custom the first heir to the throne of Portugal. He was the son of Don Alexander Farnese, Duke of Parma and Piacenza and of Maria of Portugal. His great-uncle Henry I of Portugal's death triggered the struggle for the throne of Portugal when Ranuccio was 11 years old. However, his father was an ally and even a subject of the Spanish King, another contender, so Ranuccio's rights were not very forcibly claimed at that time. Ranuccio became reigning Duke of Parma in 1592.
Instead, Ranuccio's mother's younger sister Catherine, Duchess of Braganza, claimed the throne, very ambitiously, but failed. Catherine, Duchess of Braganza was married to Duke John I of Braganza (descendant in male line from Afonso, 1st Duke of Braganza, an illegitimate son of John I of Portugal), who himself was grandson of the late Duke James of Braganza, also a legitimate heir of Portugal, being the son of infanta Isabella of Portugal, sister of Manuel I and daughter of infante Ferdinand, Duke of Viseu, second son of King Duarte I. The Duchess also had a son, Dom Teodósio of Braganza, who would be her royal heir and successor to the throne. The Duchess's claim was relatively strong, as it was reinforced by her husband's position as one of the legitimate heirs; thus they would both be entitled to hold the Kingship. Moreover, the Duchess was living in Portugal, not abroad, and was not underage, but 40 years old. Her weaknesses were her gender (Portugal had not had a generally recognized reigning queen) and her being the second daughter, there thus existed a genealogically senior claimant.
According to the old feudal custom, the line of succession of the Portuguese throne would have been:
Both António and Philip were the grandchildren of King Manuel I of Portugal :
On July 24, 1580, António proclaimed himself as King of Portugal and of the Algarves, in Santarém, which was followed by popular acclamation in several locations of the country. However, he governed in Continental Portugal for only 33 days, culminating in his defeat at the Battle of Alcântara by the Spanish armies led by Fernando Álvarez de Toledo, Duke of Alba on August 25. The Battle ended in a decisive victory for the Spanish Habsburgs, both on land and sea. Two days later, the Duke of Alba captured Lisbon.
In early 1581, António fled to France and, as Philip's armies had not yet occupied the Azores, he sailed there with a number of French adventurers under Filippo Strozzi, a Florentine exile in the service of France, but was utterly defeated at sea by a combined Spanish-Portuguese navy commanded by Don Álvaro de Bazán, 1st Marquis of Santa Cruz at the Battle of Ponta Delgada off Terceira Island on July 26, 1582 and off São Miguel Island on July 27, 1582.António's attempt to rule Portugal from Terceira Island, in the Azores (where he even minted coins) came to an end in 1583.
The combined Spanish-Portuguese navy's victory resulted in the rapid Spanish conquest of the Azores, completing the union of the Portuguese and Spanish empires. The King Philip II of Spain was recognized as King Philip I of Portugal and of the Algarves by the Portuguese Cortes of Tomar (1581). In 1589, António made an attempt on Lisbon supported by English forces under the command of Sir Francis Drake and Sir John Norreys. When the people failed to rise and yield the city to Dom António, the attempt was abandoned. Spain and Portugal would remain united in a personal union of the crowns (remaining formally independent and with autonomous administrations) for the next 60 years, until 1640. This period is called the Iberian Union.