When William landed, Marlborough was with James, but when James refused to risk battle Marlborough slipped away and joined with William. He found immediate reward under William, and in 1689 was in command of a continent of 8,000 men sent to Flanders against the French (War of the League of Augsburg, 1688-1697). In 1689 he was sent to Flanders in command of an 8,000 strong continent, and was present at the battle of Walcourt (25 August 1689), an allied victory over the French. In 1690, he was present in Ireland, and took part in William's campaign against James, capturing the ports of Cork and Kinsale, two useful bases. However, he had been keeping in verbal contact with James in exile, and in 1692 Queen Mary was convinced he was involved in treason, and he fell from favour, losing all of his commands and even spending six weeks in the tower. Only in 1695, after the death of Queen Mary and a reconciliation between William and Anne did he start to regain favour, and as it became clear that war would follow the death of the last Hapsburg king of Spain, Marlborough became increasingly prominent, as the obvious, perhaps only, candidate for command of the English land forces.
His star rose even further after the death of King William III on 19 March 1702 and for some years he performed many of the tasks that the king had for Queen Anne, even being appointed deputy captain-general of Holland, giving him command of Dutch land forces. Marlborough made his name during the ensuing War of the Spanish Succession (1701-1714), even though he did not retain command for the entire war. He was in part responsible for the changed nature of the war compared to previous conflicts, making warfare more mobile, searching out battle, and avoiding trench warfare, in the process winning a series of spectacular victories. His first campaign, in 1702, was a moderate success, and he captured Liege, and more importantly, established his reputation amongst the allies. 1703 was a year of frustration. Despite having a larger army than the French, a series of plans had to be cancelled due to Dutch objections.
1704 saw the first of his great triumphs. Bavaria had joined the French side, and the heart of the Empire was threatened, a grave danger to the allies. It was decided to send a major part of the army in the Netherlands across Germany to Bavaria, a march as long as that from London to Edinburgh, with a hostile force on the right flank. Leaving part of his army to defend Holland, Marlborough marched his army across Germany. On 2 July he won the battle of the Schellenberg, allowing him to cross the Danube, and to join with the Imperial army, and on 13 August the join armies inflicted a great defeat on the French at the battle of Blenheim. This was the first major English victory on the continent since the middle ages, and the first great defeat suffered by Louis XIV. It secured Germany, and moved the focus of the war to the French border, changing the nature of the war. In contrast, 1705 was a disappointing year. Marlborough's planned invasion of France following the line of the Moselle had to be abandoned after he was let down by his German allies. His attempts to launch the same invasion in 1706 were frustrated by French successes in Germany, but the French obligingly marched straight towards him, and he gained his second great victory at the battle of Ramillies (23 May 1706). This victory allowed him to proceed with the conquest of the Spanish Netherlands, taking Antwerp and Brussels, and leaving the French with only four border forts. This also gave the allies a much better line for the invasion of France.
However, the conquest of the Spanish Netherlands did cause political problems. The Spanish Netherlands were being claimed in the name of the Archduke Charles, the Imperial candidate for the Spanish throne, a claim that his allies found hard to ignore. In 1707, Marlborough was offered the governorship of the Spanish Netherlands, but it was clear that the Dutch would not accept any such appointment, and he had to refuse. In 1708, the Spanish Netherlands once again caused problems, this time a revolt in the southern Netherlands against Anglo-Dutch rule. The French quickly moved to help the rebels, and were let into several towns, before advancing on the important fortress of Oudenarde. Marlborough surprised the French, and attacked them quickly, before his army was formed up (Battle of Oudenarde, 11 July 1708). The French were scattered, and Marlborough wanted to take the chance to march of Paris, but was stopped by Prince Eugene, who would not move until the powerful fortress at Lille had been captured. The fortress fell on 11 December 1708, removing one more barrier on the road to Paris.
In 1709, Marlborough was finally able to march into France, aiming for Mons. At Malplaquet (11 September), he won his last great victory, but took heavier losses than the French, demonstrating that the march on Paris would not be easy, despite the relatively short distance involved. At this point, Marlborough began to lose control of the political situation at home. The length and apparent futility of the war, especially in Spain, had reduced support for the war, while his wife had become estranged from the Queen, removing his greatest prop. Finally, in August 1710 the government he supported was replaced with one determined to make peace, and although Marlborough stayed on as commander in chief, his influence was broken. In 1711, he managed to break the Ne Plus Ultra line of French defences with a long night march, seen by some as his greatest achievement, but on 31 December 1711 he was dismissed. He returned briefly to England, but soon returned to the continent and did not return until the day Queen Anne died. Between then and his death in 1722 he remained wealthy, and was honoured for his victories, but no longer intervened in politics, in part due to his age.