Anglo-Spanish War (1796–1808)

The war ended when an unexpected alliance was formed between Great Britain and the Spanish Bourbon dynasty, resulting in the French invasion.

The alliance continued the longstanding cooperation between France and Spain established by the Pacte de Famille in 1733, broken only by the French Revolution.

The war was damaging for Spain and for the Spanish Crown's revenues, with the British blockade greatly reducing the amount of wealth arriving from the colonies.

A main Spanish fleet, under José de Córdoba y Ramos, had 27 ships of the line, however, and planned to link with the French and protect convoys of valuable goods.

However, the Spanish Navy proved incapable of coordinating with its French Republican allies, and was heavily defeated at the Battle of Cape St. Vincent.

A major assault on the port of San Juan, Puerto Rico, in April 1797 failed after fierce fighting where both sides suffered heavy losses.

The Treaty of Amiens in 1802 provided for a temporary truce in hostilities, only to be broken in 1804 when, by surprise and without declaration of war, British ships attacked a Spanish squadron of frigates that was carrying gold and silver bullion to Cádiz.

Meanwhile, a British campaign (1806–1807) to conquer the strategically important Río de la Plata region in Spanish South America met with failure.