Sir George Rooke captured Gibraltar for the British during the War of the Spanish Succession, and Spain formally ceded it to Britain in 1713.