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.