In February 1808 Napoleon had boasted that 12,000 men would suffice to conquer Spain; by June, 120,000 troops had been poured into the country in an effort to subdue the revolt. The main French army of 80,000 men held a narrow strip of central Spain stretching from Pamplona and San Sebastian in the north to Madrid and Toledo to the south. The French in Madrid took shelter behind an additional 30,000 troops under Moncey. Napoleon believed that holding on to Madrid while seizing Spain's main cities with flying columns would quickly restore the situation and quell the uprisings. Accordingly, General Dupont led 24,000 men south with Seville and Cádiz as his goal; Bessières moved into Aragon and Old Castile with 25,000 men, aiming to capture Santander with one hand and Saragossa with the other; Moncey marched toward the Mediterranean with 10,000 men, Valencia in his sights; and Duhesme marshalled 13,000 troops in Catalonia and put Girona under siege.
Napoleon had "no opinion whatsoever of local militias or popular levies," and tried to spain at onse with a too-small force; Twice in June, detachments leaving Barcelona for the front ran afoul Catalan militia along the Bruch and were forced back with heavy casualties. After storming and sacking Cordoba, Dupont, frightened by the violent hostility of the Andalusians, abandoned his offensive and retired to Andujar. Girona resisted all efforts to conquer it. In Saragossa General Palafox and the Spaniards defied the French for three months, fighting inch by inch, corps à corps, in the streets, and eventually forcing the French to lift the siege and limp away in defeat. Moncey's masterful push along the coast was halted outside the walls of Valencia and gave way to a long retreat which proved no less impressive, but also no less futile. Only in the north did the French see success: Bessières, his march on Santander blocked by partisans, turned back in frustration only to find Blake and Cuesta with their army atop Medina del Rio Seco. The Spanish generals, at Cuesta's insistence, had made a foolhardy dash towards Valladolid and left themselves quite exposed. After a sharp fight on July 14 the French poured into the gap Cuesta had unwisely opened between his troops and Blake's, and the motley Spanish army was swept from the field and scattered, leaving Old Castile firmly in Napoleon's hands.
At a stroke, Bessières' victory salvaged the strategic position of the French army in northern Spain. The failures at Valencia and Saragossa were forgotten; all that remained was to reinforce Dupont and allow him to force his way south through Andalusia. A delighted Napoleon asserted, "if Marshal Bessières has been able to beat the Army of Galicia with few casualties and small effort, General Dupont will be able to overthrow everybody he meets."A few days later, Dupont was defeated in battle at Bailén and surrendered his entire Army Corps to General Castaños. The catastrophe was total—with 24,000 troops erased from the map, Napoleon's military machine abruptly collapsed. The French command panicked and ordered a general retreat to the Ebro, abandoning Madrid and undoing all of Bessières' hard-fought gains. Europe trembled at this first check to the hitherto unbeatable Imperial armies. Bailén contributed to the rise of the Fifth Coalition against Napoleon: With French forces being defeated in Spain, the Austrians Saw their chance at regaining their territories from France.
In August 1808 British forces landed in Portugal under the command of Major-General Sir Arthur Wellesley. Wellesley checked Delaborde's forces at Roliça on August 17, while the Portuguese Observation Army of Bernardim contained Loison. On August 21, the Anglo-Portuguese were strongly engaged at the Battle of Vimeiro by French forces under the command of Junot. Wellesley's sound tactics repulsed the French and the Allies held their line. Despite his abilities, Wellesley was replaced as commander by Harry Burrard, who stopped the pursuit that would have destroyed Junot's army and immediately thereafter by Hew Dalrymple as he was considered too junior an officer to command the newly-reinforced expedition to Portugal. In the aftermath Dalrymple lost his wits and offered Junot very favourable armistice terms, allowing for his unmolested evacuation from Portugal—courtesy of the Royal Navy—under the controversial Convention of Sintra in August. The three British commanders were ordered back to England for an inquiry into Sintra, leaving command of the 30,000-strong British force to Sir John Moore.
This new expedition enjoyed the advantages of the Royal Navy's command of the seas. After the destruction of the French and Spanish fleets at the Battle of Trafalgar, Vice-Admiral Lord Collingwood's Mediterranean Fleet had bottled up the remaining French fleet at Toulon. The role of the Navy in supply, convoy protection, and intelligence-gathering around the Iberian Peninsula in 1808 was vital to the eventual British success, as Wellington later acknowledged. The actions of the Royal Navy along the Catalan coast of France and Spain slowed the French entry into eastern and southern Spain and drained their military resources in the area. During the whole of 1808 the Royal Navy was active in the defence of Spain, notably during the siege of Roses in Catalunya. Frigate captains such as William Hoste, Jahleel Brenton and Lord Cochrane operated around the strategically vital Gulf of Roses, close to the French border north of Barcelona. In one incident, Lord Cochrane defended a cliff-top fortress against French artillery and infantry for nearly a month, eventually destroying it when the main citadel at Roses capitulated to a superior French force.
If Bailén convinced Napoleon of the need to mend matters in Spain with his own hand, the liberation of Portugal brought home the full urgency of the situation. The Emperor, deeply disturbed by news of Cintra, remarked in disgust, "I see that everybody has lost their head since the infamous capitulation of Bailén. I realize that I must go there myself to get the machine working again." The French, so lately masters of Spain, had been reduced to clutching at scraps of land in Navarre and Catalonia, and it was doubtful if even these two footholds could be maintained in the face of a new Spanish attack. Luckily, no attack was forthcoming. Shaken by the shock of rebellion, the Spanish social fabric succumbed to a host of underlying social and political tensions which divided the loyalties of the rebels and fragmented their war effort. Local juntas, to which effective power had devolved since the fall of the monarchy, interfered in military operations, undermined the tentative central government taking shape in Madrid, proved almost as dangerous to each other as to the French, and went about the business of war with hardly a trace of coordination. The British army in Portugal, meanwhile, was itself bogged down in logistical problems and petty administrative disputes, and could not budge. Consequently, months passed with silence on the front; the revolution had "temporarily crippled Patriot Spain at the very moment when decisive action could have changed the whole course of the war."
The Spanish attacked near Burgos, but were defeated and forced into a long retreat, chased by the French in a series of maneuvers punctuated by battles at Pancorbo, Valmaseda, Burgos, Tudela, Espinosa, Somosierra, Saragossa, Castellon and Ucles. Only at Saragassa, still in ruins from Lefebvre's bombardment, was the French tide staunched once again by Palafox and his followers. The Spanish troops that had broken and fled from so many fights now proved unmoveable, and Moncey's 45,000 French soldiers found themselves locked in a second costly siege. French guns made no impression on the steadfast Spaniards and Moncey's overtures for an honorable capitulation were met with the laconic reply: "War to the knife." The war's single most brutal battle unfolded, keeping 45,000French troops delayed for a month.
The British advanced into Spain to support the Spanish armies opposed to Napoleon, but before they arrived, the Grande Armee had smashed the three spanish armies opposed and rounded on the small British force.
Sir John Moore led his army north towards the Spanish port of Corunna to draw the French army away from Portugal. The orderly withdrawal gave way to a nightmare winter retreat over mountainous terrain without supplies(The Spanish had promised the British supplies but never delivered, only the first time the Spanish failed their British allies). Many men left their units from exhaustion, others fell dead by the wayside, hundreds became so drunk they had to be left behind(Many of these helpless men were slaughtered or mutilated by the pursuing French cavalry).
The guard regiments and the rearguard kept their order, however and the French pursuers were defeated at Sahagun, Benavente, and Cacobellos where Irish rifleman shot French general Auguste Colberte.
Midway through the retreat Napoleon returned to the east to cambat the new coalition led by the Austrians.
In January, the British straggled into Corunna, the exhausted soldiers cast themselves down to rest while store and wounded were loaded aboard the Royal Navy ships already there.
On the 16th the French army of Marshall Soult attacked, attempting to halt the embarkation. The French were repulsed with heavy losses and the British embarkation continued. Sir John Moore was struck by a cannonball during the fighting and died shortly after.
While Soult was drawn north, several French armies were involved in the invasion of southern Spain(Andulusia) resisted by the Spanish Army of Estremadura under general Gregorio de la Cuesta.The Spanish army was destroyed at the battle of Medellin, but the French paused to rest their troops and failed to take advantage of the victory to sieze the vital city of Cadiz, which thereafter proved a thorn in the French side.
In March, Marshal Soult invaded Portugal through the northern corridor. Initially repulsed in the Minho river by Portuguese militias, he then captured Chaves, Braga and, on March 29, 1809, Porto. Yet, the resistance of Silveira in Amarante and other northern cities isolated Soult in Oporto.
Meanwhile, Napoleon's victories had broken the Spanish armies, but had also forced the Spanish to begin the guerrilla warfare that would contribute to the downfall of the French in Spain. In Portugal, Miguel Pereira Forjaz, the Secretary of War, had rebuilt the Portuguese Army with money and arms received from the British. The Reform of the Army, held up since 1806, was implemented. In a first phase some 20,000 were called to the Regular Army and some 30,000 to Militias. Later on, this number would grow to 50,000 in the Army and another 50,000 in Militias, in addition to Ordenanças and voluntary units.
Wellesley returned to Portugal in April 1809 to command the Anglo-Portuguese forces. He strengthened the British army with the recently formed Portuguese regiments organized by Forjaz and the Governors of the realm and adapted by General Beresford to the British way of campaigning. These new forces defeated Soult at the Battle of Grijo (May 10 – May 11) and then the Battle of Oporto (May 12). All other northern cities were captured by Silveira.
Leaving the Portuguese to take care of their newly-won territory, Wellesley advanced into Spain to join up with the Spanish army of Gregorio de la Cuesta. The combined Allied force had a sterling opportunity to defeat the French corps of Victor at Talevera, but Cuesta's insistence that the Spanish wouldn't fight on a Sunday provided the French the chance to get away. The next day, having lost the best chance for victory they were likely to get, Cuesta sent his army headlong after Victor, losing a clash with the reinforced French army (now led by King Joseph). The Spanish retreated precipitously, necessitating several British battalions advancing to cover their retreat and almost leading to the capture of Wellesley by French cavalry, (just one of the many times the French almost got him). That night, a patrol of French dragoons spooked the Spanish infantry: ten thousand men opened fire at once in one of the largest single volleys of the Napoleonic Wars. Panicked by their own fire, the Spaniards turned and ran, playing nearly no part in the battle the next day.
The next day, July 27, the French advanced in three columns and were repulsed several times throughout the day by British infantry in line, forcing the French to withdraw. the Battle of Talavera de la Reina was a costly victory that left the allies precariously exposed. The British soon retreated westwards, leaving several thousand of their wounded under Cuesta's protection. The Spanish abandoned them shortly afterwards and they were rescued from their allies by the French. Although the Spanish had promised food to the British if they advanced into Spain, not only was no food given, but Spanish troops threatened to pillage any town that sold food to their 'allies,' forcing the British to continue retreating back to Portugal. The British in the peninsula never quite trusted the Spanish again. Wellesley was made viscount for his victory at Talavera. Later that year, however, Spanish armies were badly mauled at the Battle of Ocana and the Battle of Alba de Tormes.
After his disappointing experience of collaboration with the Spaniards, and expecting a French attack, Wellesley strengthened Portugal's defences. To protect Lisbon, he took a plan from Major Neves Costa and ordered the construction of a strong line of 162 forts along key roads and entrenchements and earthworks, the Lines of Torres Vedras.