During the War of the Spanish Succession, Spain lost Gibraltar to an Anglo-Dutch fleet and when the war finished in 1714, Spain was forced to accept the loss of Gibraltar in the Treaty of Utrecht. Despite this it was a long-term goal of Spain to recover both Gibraltar and the island of Menorca from the British. After the Treaty of Vienna in 1725, Spain had the support of Austria, and thought the time was right to try to recapture Gibraltar. As a reaction Britain signed the Treaty of Hanover with France and Prussia. Some historians put the beginning of the war in 1726, because in that year the Anglo-Spanish relation was already very tense. A British fleet was sent to the Spanish West Indies to disturb Spanish shipping, without actually starting a war.
Britain had tried to use its naval power early in the dispute, by blockading Porto Bello in Panama but the attempt proved a disaster, in which 4,000 men were lost to disease. The main objective of the blockade had been to prevent Spanish galleons leaving and sailing for Spain, but the blockaders failed to do this - and eventually withdrew.
On 11 February 1727 Spain, under command of the Marquis de las Torres and supervision of Chief Engineer of the Spanish Royal Engineer CorpsMarquis of Verboom, laid siege to the city. Depending on the sources, Spanish troops were between 12,000 and 25,000. British defenders were 1,500 at the beginning of the siege, increasing up to about 5,000 by troops brought from overseas by a fleet commanded by Charles Wager. After a four-month siege, with several unsuccessful and costly attempts, Spanish troops gave up and retired on 12 June. Spain had lost over 1,400 men while the British had suffered around 300 casualties. The Spanish had expected material help from the Austrians promised under the Treaty of Vienna, but they received little. They had been outmanoeuvred by British diplomats, who had concluded a secret deal with the Austrians to prevent them intervening.
Peace
No more hostilities took place and a truce was declared in February 1728, with a preliminary agreement of issues at the March Convention of El Pardo and the Congress of Soissons. The final peace, that confirmed the status-quo, was concluded in the 1729 Treaty of Seville. Many of the outstanding issues between the two states had not been resolved, and a decade later the War of Jenkins' Ear broke out between them. Britain emerged from the conflict by forming a very strong alliance with Austria, that lasted until 1756.