The 19th century is a century of change in Spain. The liberal movements and ideals that came from the French Revolution at the end of the 18th century prompted the Spanish to fight for their rights. There were many political movements from 1808 to the beginning of the 1900s, alternating between liberal governments and absolutists one. It's also during this period that the First Spanish Republic took place, although it was short lived. The 19th century set the foundation for further democratic and liberal movement that would take place in Spain during the 20th century.
The French Revolution is the cause for the first liberal movements in Spain. 1808 is marked as the start of the movement in Spain. The French had invaded the country and the Court was moved to Aranjuez in case the royal family had to flee to America. At that moment, the king was Charles IV. Ferdinand VII, his son, had been conspiring against him and Godoy to get to the throne.
The 17th of March of 1808, there was a popular uprising and Charles IV was forced to abdicate the throne to his son Ferdinand VII. Ferdinand went back to court, without knowing that the French troops had occupied Madrid the day before. The shunned king and queen went under Napoleon's protection, and the French general agreed to meet Ferdinand, who thought the Frenchman wanted to officially honor him as King of Spain. However, Napoleon tricked him and sent him to exile. The people weren't too happy about this, and they stood up against the French. This began the War of Spanish Independence of the 2nd of May of 1808.
Meanwhile, Napoleon had tricked Charles IV and Ferdinand VII into letting the Spanish throne go, and gave it to his brother Joseph Bonaparte, turning him into Joseph I of Spain. During the War of Spanish Independence, the Spanish liberal movements get together in the Cortes in to draw up a new Constitution (1812). The new text will cause some difference between the liberals, because some of them want to implement the new Constitution but the rest want to keep the Enlightened Despotism that had been implanted during the reign of Ferdinand VII.
The War of Spanish Independence finished on 1814, with the victory of the Spanish troops. Joseph Bonaparte gave the throne back to Ferdinand VII, who had suffered from humiliation during his exile with Napoleon. His hatred towards the French made him dissolve the Cortes and abolish the new Constitution. He also censored the press, banned the theatre and decreed that the liberals should be persecuted and put in jail, so many of them went on exile.
The repression of Ferdinand after the small taste of liberalism the Spanish had had was too much. Military uprisings were very common, and finally, General Riego managed to overcome the monarchists and bring back the Constitution, forcing Ferdinand to accept it as an official document of the Reign of Spain. However, he was plotting behind Riego's back to bring him down, and he called upon other European monarchs to help.
Europe was worried that Spain's liberal movements would catch on to other countries, and they couldn't have that upset the delicate power balance. The Hundred Thousand Sons of Saint Louis were the French troops that were sent to Spain in 1823, with the aim of bringing down Riego and returning Spain to its absolutist government. This period of Spanish history is called the Ominous Decade, and it lasted from 1823 to 1833. During this time, liberals were persecuted and sentenced to death. This was Riego's fate, as instigator of the Revolution.
As Ferdinand became weaker and weaker, the people around him pressured him to abolish the Salic Law so that his daughter Isabella could inherit the throne. If she didn't, it would pass to Carlos María Isidro, the king's brother. The court was divided into two groups: the carlists wanted the king's brother to reign, while the "cristinos" wanted María Cristina de Borbón-Dos Sicilias, Isabella's mother, to reign as regent while her daughter came of age.
Ferdinand died in 1833 and Isabella was proclaimed Queen of Spain while she was only 3 years old. Her mother acted as a regent from 1833 to 1840, and General Espartero from 1841 to 1843, when Isabella II ascended to the throne at the age of 13. The liberals were on her side, but the carlists still wanted her uncle Carlos María Isidro to reign, and this gave way to the three Carlist Wars between 1833 and 1876. During this time, the liberal movements were in power, and they modernized Spain to put the country up to par with the rest of Europe.
The Carlist Wars left Spain in a state of stagnation, and the constant fights between the liberals and the conservatives put Spain in a very difficult and unstable political situation. The Bourgeois Revolution started in 1868, which put and end to Isabella's reign. Another Constitution is approved in 1869 and Amadeo de Saboya takes the throne in Madrid as a democratic monarch, but he stepped down for lack of support, and a republic is established. It was the First Republic in Spain and it lasted a very short period of time, from 1873 to 1874.
On October of 1874, the General Martínez Campos started a uprising to get the monarchy back in Spain, and Alfonso XII (the son of Isabella II) became King of Spain. A new Constitution is approved in 1876 to give power to the people, dividing it equally between them and the monarch. After the death of Alfonso XII, his son Alfonso XIII took the throne under the regency of his mother, María Cristina de Habsburgo-Lorena. The Spanish-American war took place during his reign, and Spain lost Cuba and the Philippines in what is known as "Disaster of '98". After the end of the war, Spain lost all its other territories in South America.
The 19th century was a very tumultuous time for Spain, and it's studied in most schools in Spain as the century that changed everything in Spain.