The road to war began in the autumn of 1807 when Napoleon moved French troops through Spain to invade Portugal. After feeding more than 100,000 troops into Spain under the pretext of supporting the invasion, Napoleon deposed the existing Spanish monarch in April 1808 in order to place his own brother Joseph on the throne. Although the ensuing Spanish uprising can hardly have come as a surprise to Napoleon, he failed to see that the revolt could never be completely suppressed.

Britain now had a new ally in Spain and in August 1808 landed an expeditionary force under the command of Lt.-Gen. Sir Arthur Wellesley at the mouth of the Mondego river in Portugal. Moving south towards Lisbon, Wellesley defeated Delaborde at Roliça on 17th August before turning to the mouth of the Maceira river to protect the landing of reinforcements. On 21st August, Wellesley's position around Vimeiro Hill was attacked from the east by Junot. The Battle of Vimeiro was the first occasion on which Napoleonic offensive tactics combining skirmishers, columns and supporting artillery fire failed against the British infantry line and Wellesley's defensive skills. Junot was defeated, though an opportunity to inflict further damage on the French was lost as the out-ranked Wellesley was replaced first by Burrard and then by Dalrymple. Wellesley's victory was still sufficient to persuade the French to evacuate Portugal as part of a controversial agreement which became known as the Convention of Sintra.

The departure of Dalrymple, Burrard and Wellesley to face criticism of the Convention in Britain left Sir John Moore in command of a British army of 30,000 in Portugal. The scale of the war in the Peninsula escalated as a Spanish victory over Dupont at Bailén in July was answered by Napoleon's arrival in Spain at the head of 200,000 veteran troops. Moore struck towards Burgos and the northern flank of Napoleon's army, succeeding in drawing French forces away from southern Spain before being forced to retreat westwards. The retreat ended in the evacuation by sea of Moore's army at La Coruña in January 1809, and in the loss of Moore's own life. Napoleon meanwhile had transferred command of the pursuit to Soult and returned to Paris, never again to lead an army in the Peninsula.

In April 1809 Wellesley, freed from criticism over the Convention of Sintra, returned to Portugal and assumed command of all British-Portuguese forces. Immediately, he implemented three innovations in army organization: the infantry were for the first time divided into autonomous divisions, each infantry brigade was provided with at least one company of riflemen, and - to mutual benefit - one battalion of Portuguese infantry was placed in each of five British brigades.

After defeating Soult at Porto on 12th May, Wellesley crossed the border into Spain, joined forces with the Spanish general Cuesta, and marched eastwards. On 27th-28th July, French armies under Joseph attacked the allies north of Talavera. The British-Portuguese lines held throughout the Battle of Talavera, finally compelling Joseph to abandon the battlefield. The victory had, however, been costly and, with Soult threatening to cut the road to Portugal, Wellesley was forced to fall back.

The latter months of 1809 saw Spanish armies crushed first at Ocaña and then at Alba de Tormes, while Wellesley, now Viscount Wellington of Talavera, concentrated on building defences astride the roads into Portugal and began construction work on the Lines of Torres Vedras, a deep defensive system protecting Lisbon.

The value of Wellington's preparations was proved in the following year when Masséna led a French army through Ciudad Rodrigo and Almeida in a fresh attempt to re-take Portugal. Despite being repulsed on 27th September 1810 in his attacks against Wellington's position on the ridge at Buçaco, Masséna was able to force Wellington to seek safety behind the Lines of Torres Vedras. Masséna had no chance of breaking through with the forces at his disposal, and a stand-off ensued until a lack of supplies and the imminent arrival of British reinforcements in the spring of 1811 led Masséna to fall back.

With one French army under Soult checked by Graham's victory at Barrosa on 5th March 1811, Wellington was able to push Masséna out of Portugal. Counter-attacks at Fuentes de Oñoro on 3rd and 5th May 1811 were repulsed after desperate struggles in the streets of the village. Masséna, having failed to re-take Portugal, was replaced by Marmont. A further bloody battle took place at Albuera on 16th May as Soult's move north was intercepted by a combined British-Portuguese-Spanish force under Beresford. Although Beresford's handling of the battle - in which the French made the largest single infantry attack of the War - attracted much criticism, Soult was finally forced to retreat. French armies continued to threaten Wellington throughout the latter months of 1811, but at no time were able to catch him at a disadvantage. The turning point of the war had been reached.