In the second day of fighting at the Peninsular War Battle of Fuentes de Oñoro the French army, under Marshall André Masséna, drive in the Duke of Wellington's overextended right flank, but French frontal assaults fail to take the town of Fuentes de Oñoro and the Anglo-Portuguese army holds the field at the end of the day.

In the Battle of Fuentes de Ooro (35 May 1811), the British-Portuguese Army under the Duke of Wellington checked an attempt by the French Army of Portugal under Marshal Andr Massna to relieve the besieged city of Almeida.

A bloody stalemate was not the sort of battle that had been expected to follow Massna's expulsion from Portugal. His confidence and moral authority having been much boosted by Torres Vedras, the spring of 1811 found Wellington intending to move over to the offensive, for which policy he had received de facto authorization from his political masters in London, where talks of major reductions in the size of the army employed in Portugal had been replaced by promises of major reinforcements. Supply difficulties, sickness amongst the troops and want of siege artillery ensured that in the short term no great strokes of strategy could be envisaged, but it was hoped that Almeida, Ciudad Rodrigo and Badajoz might be all recaptured, thereby opening the way for lightning strikes on such targets as Salamanca or Seville. In the event, however, success was limited, the story of the rest of 1811 essentially being one of failure and frustration.

The Peninsular War (1807–1814) was the military conflict fought in the Iberian Peninsula by Spain, Portugal, and the United Kingdom against the invading and occupying forces of the First French Empire during the Napoleonic Wars. In Spain, it is considered to overlap with the Spanish War of Independence. The war began when the French and Spanish armies invaded and occupied Portugal in 1807 by transiting through Spain, and it escalated in 1808 after Napoleonic France had occupied Spain, which had been its ally. Napoleon Bonaparte forced the abdications of Ferdinand VII and his father Charles IV and then installed his brother Joseph Bonaparte on the Spanish throne and promulgated the Bayonne Constitution. Most Spaniards rejected French rule and fought a bloody war to oust them. The war on the peninsula lasted until the Sixth Coalition defeated Napoleon in 1814, and it is regarded as one of the first wars of national liberation and is significant for the emergence of large-scale guerrilla warfare.

The war began in Spain with the Dos de Mayo Uprising on 2 May 1808 and ended on 17 April 1814 with the restoration of Ferdinand VII to the monarchy. The French occupation destroyed the Spanish administration, which fragmented into quarrelling provincial juntas. The episode remains as the bloodiest event in Spain's modern history, doubling in relative terms the Spanish Civil War.A reconstituted national government, the Cortes of Cádiz—in effect a government-in-exile—fortified itself in the secure port of Cádiz in 1810, but could not raise effective armies because it was besieged by 70,000 French troops. British and Portuguese forces eventually secured Portugal, using it as a safe position from which to launch campaigns against the French army and provide whatever supplies they could get to the Spanish, while the Spanish armies and guerrillas tied down vast numbers of Napoleon's troops. By restricting French control of territory, the combined allied forces, both regular and irregular, prevented Napoleon's marshals from subduing the rebellious Spanish provinces, and the war continued through years of stalemate.The British Army, under then Lt. Gen. Sir Arthur Wellesley, later the 1st Duke of Wellington, guarded Portugal and campaigned against the French in Spain alongside the reformed Portuguese army. The demoralized Portuguese army was reorganized and refitted under the command of Gen. William Beresford, who had been appointed commander-in-chief of the Portuguese forces by the exiled Portuguese royal family, and fought as part of the combined Anglo-Portuguese Army under Wellesley.

In 1812, when Napoleon set out with a massive army on what proved to be a disastrous French invasion of Russia, a combined allied army under Wellesley pushed into Spain, defeating the French at Salamanca and taking the capital Madrid. In the following year Wellesley scored a decisive victory over King Joseph Bonaparte's army in the Battle of Vitoria. Pursued by the armies of Britain, Spain and Portugal, Marshal Jean-de-Dieu Soult, no longer getting sufficient support from a depleted France, led the exhausted and demoralized French forces in a fighting withdrawal across the Pyrenees during the winter of 1813–1814.

The years of fighting in Spain were a heavy burden on France's Grande Armée. While the French were victorious in battle, they were eventually defeated, as their communications and supplies were severely tested and their units were frequently isolated, harassed or overwhelmed by partisans fighting an intense guerrilla war of raids and ambushes. The Spanish armies were repeatedly beaten and driven to the peripheries, but they would regroup and relentlessly hound and demoralize the French troops. This drain on French resources led Napoleon, who had unwittingly provoked a total war, to call the conflict the "Spanish Ulcer".War and revolution against Napoleon's occupation led to the Spanish Constitution of 1812, promulgated by the Cortes of Cádiz, later a cornerstone of European liberalism. The burden of war destroyed the social and economic fabric of Portugal and Spain, and ushered in an era of social turbulence, increased political instability, and economic stagnation. Devastating civil wars between liberal and absolutist factions, led by officers trained in the Peninsular War, persisted in Iberia until 1850. The cumulative crises and disruptions of invasion, revolution and restoration led to the independence of most of Spain's American colonies and the independence of Brazil, which remained a monarchy, after severing ties with Portugal.