The Anglo–Spanish War was a military conflict fought between Britain and Spain as part of the Seven Years' War. It lasted from January 1762 until February 1763 when the Treaty of Paris brought it to an end.
For most of the Seven Years' War, Spain remained neutral, turning down offers from the French to join the war on their side. During the war's latter stages, however, with mounting French losses to the British leaving the Spanish Empire vulnerable, King Charles III signaled his intention to enter the war on the side of France. This alliance became the third Family Compact between the two Bourbon kingdoms. After Charles had signed the agreement with France and seized British shipping alongside expelling British merchants, Britain declared war on Spain. In August 1762, a British expedition captured Havana, then a month later capturing Manila as well. The loss of the colonial capitals in the Spanish West Indies and East Indies was a huge blow to Spanish prestige and its ability to defend its empire. Between May and November, three major Franco-Spanish invasions of Portugal, Britain's long time Iberian ally, were defeated.