The War Of the Spanish Succession was a European war fought between 1702 and 1714 by France, Spain and Bavaria on one side and Austria, Prussia, Great Britain, Holland, Denmark and Portugal on the other side. The origins of the War Of the Spanish Succession are to be found in the partition treaties of 1698 and 1700 by which Louis XIV had renounced all claims of his family to the throne of Spain.
When Charles II of Spain died in 1700, Louis XIV ignored his obligations and claimed the throne for his grandson, Philip of Anjou, while the Emperor Leopold claimed it for his son, the archduke Charles. The French occupied the fortresses in the Spanish Netherlands in 1701, and were attacked by the Austrians in northern Italy. William III, foreseeing the conflict, formed a league called the 'Grand Alliance' which completed its preparations and declared war in 1702. A combined army of British and Dutch under the Duke of Marlborough advanced into the Spanish Netherlands. A German army crossed the Rhine, and was subsequently defeated at Friedlingen. Meanwhile, the campaign was carried into Italy by Prince Eugene.
Together with the elector of Bavaria, Louis directed an attack towards Vienna, in response to which the Duke of Marlborough marched to the Danube, joined forces with Eugene and defeated the French at Blenheim on August the 13th 1704. The French withdrew across the Rhine, pursued by the Duke of Marlborough who carried the war into the Moselle valley. In 1705 the Duke of Marlborough returned to Flanders and gained the hole country by his victory at Ramillies on May the 23rd 1706. Meanwhile, Eugene had defeated the French in Italy, British forces had captured Gibraltar in 1704 and France looked beaten. However, campaigns of 1707 were less successful and early in 1708 the French captured Ghent and Bruges.
On July the 11th 1708 the Duke of Marlborough won a victory at Oudenarde, recaptured the lost cities and took Lille. Louis XIV asked for peace, but rejected the Allies terms. Tournai was taken, the French under Marshal Villars were defeated at Malplaquet on September the 11th 1709, and Mons was captured by the British. The Duke of Marlborough was recalled in 1710 and dismissed by the Tory government, leaving the war to drag on until an armistice was signed in July 1712 between Great Britain and France. Holland, Prussia and Savoy continued fighting until the Treaty of Utrecht was signed on April the 11th 1713. The new emperor Charles VI fought on for another year, before concluding a peace at Rastatt which was ratified in the treaty of Baden on September the 7th 1714.
After the capture of Gibraltar in 1704 the British and Dutch, cooperating with the Archduke Charles, took Barcelona on October the 9th 1705, while another force under Galway entered Madrid in 1706. However, Madrid was taken by the French under the duke of Berwick who defeated Galway's army on the plain of Almansa on April the 25th 1707.