Peninsular War: Battle of Talavera: Sir Arthur Wellesley's British, Portuguese and Spanish army defeats a French force led by Joseph Bonaparte.

The Battle of Talavera (2728 July 1809) was fought just outside the town of Talavera de la Reina, Spain some 120 kilometres (75 mi) southwest of Madrid, during the Peninsular War. At Talavera, an Anglo-Spanish army under Sir Arthur Wellesley combined with a Spanish army under General Cuesta in operations against French-occupied Madrid. The French army withdrew at night after several of its attacks had been repulsed.

After Marshal Soult's French army had retreated from Portugal, General Wellesley's 20,000 British troops advanced into Spain to join 33,000 Spanish troops under General Cuesta. They marched up the Tagus valley to Talavera, some 120 kilometres (75 mi) southwest of Madrid. There they encountered 46,000 French under Marshal Claude Victor and Major-General Horace Sbastiani, with the French king of Spain, Joseph Bonaparte in nominal command.

The French crossed the Alberche in the middle of the afternoon on 27 July. A few hours later, the French attacked the right of the Spaniards and the British left. A strategic hill was taken and lost, until, finally, the British held it firmly. At daybreak on 28 July, the French attacked the British left again to retake the hill and were repulsed when the 29th Foot and 48th Foot who had been lying behind the crest stood up and carried out a bayonet charge. A French cannonade lasted until noon, when a negotiated armistice of two hours began. That afternoon, a heavy exchange of cannon fire started ahead of various infantry and cavalry skirmishes. Early in the evening, a major engagement resulted in the French being held off. A cannon duel continued until dark. At daylight, the British and Spanish discovered that the bulk of the French force had retired, leaving their wounded and two brigades of artillery in the field. Wellesley was ennobled as Viscount Wellington of Talavera and of Wellington for the action.

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.