A Spanish document of 1820 which certifies that the King swore the Constitution.

The Trienio Liberal (Spanish pronunciation: [ˈtɾjenjo liβeˈɾal], "Liberal Triennium") was a period of three years of liberal government in Spain. After the revolution of 1820 the movement spread quickly to the rest of Spain and the Spanish Constitution of 1812 was reinstated. The Triennium was a volatile period between liberals and conservatives in Spain, and constant political tensions between the two groups progressively weakened the government's authority. Finally in 1823, with the approval of the crown heads of Europe, a French army invaded Spain and reinstated the King's absolute power. This invasion is known in France as the "Spanish Expedition" (expédition d’Espagne), and in Spain as "The Hundred Thousand Sons of St. Louis".

Spain's King Ferdinand VII provoked widespread unrest, particularly in the army, by refusing to accept the liberal Spanish Constitution of 1812. The King sought to reclaim the Spanish colonies in the Americas that had recently revolted successfully, consequently depriving Spain from an important source of revenue. In January 1820, soldiers assembled at Cadiz for an expedition to South America, angry over infrequent pay, bad food, and poor quarters, mutinied under the leadership of Colonel Rafael del Riego y Nuñez. Pledging fealty to the 1812 Constitution, they seized their commander. Subsequently the rebel forces moved to nearby San Fernando where they began preparations to march on the capital of Madrid.

Despite the rebels' relative weakness, Ferdinand accepted the constitution on March 9, 1820, granting power to liberal ministers and ushering in the so-called Liberal Triennium (el Trienio Liberal), a period of popular rule. However, in this liberal atmosphere, political conspiracies of both right and left proliferated in Spain, as was the case across much of Europe. Liberal revolutionaries stormed the King's palace and seized Ferdinand VII who was a prisoner of the Cortes in all but name for the next three years. During this time Ferdinand retired to Aranjuez. The elections to the Cortes Generales in 1822 were won by Rafael del Riego. Ferdinand's supporters set themselves up at Urgell, took up arms and put in place an absolutist regency. Ferdinand's supporters, accompanied by the Royal Guard, staged an uprising in Madrid which was subdued by forces supporting the new government and its constitution. Despite the defeat of Ferdinand's supporters at Madrid, civil war erupted in the regions of Castile, Toledo, and Andalusia.

In 1822, Ferdinand VII applied the terms of the Congress of Vienna, lobbied for the assistance of the other absolute monarchs of Europe, in the process joining the Holy Alliance formed by Russia, Prussia, Austria and France to restore absolutism. In France, the ultra-royalists pressured Louis XVIII to intervene. To temper their counter-revolutionary ardor, the Duc de Richelieu deployed troops along the Pyrenees Mountains along the France-Spain border, charging them with halting the spread of Spanish liberalism and the "yellow fever" from encroaching into France. In September 1822 this "cordon sanitaire" became an observation corps and then very quickly transformed itself into a military expedition.