The 18th century and Enlightenment in Spain starts with the Succession War (1701-1714). Charles II was the last of the Habsburgs, and he was childless. The economic, social and political problems had made of Spain a declining empire, but the colonies in the New World and the huge naval fleet of the Spanish Armada gave Spain a vital role in European politics. The power balance in Europe was very frail. If Spain gave the throne to a relative of the king of France and Spain and France united, the power would shift to France. However, if it remained in the Habsburg family, the power balance would not be affected. Because of this, the European politics of the 18th century centered around finding a succession to the Spanish throne that would not alter the delicate balance of the continent.
There were two main candidates: Philip, grandson of the King of France; and Archduke Charles of Austria, who was the Austrian applicant to the throne. The effect the change could have in all of Europe was so important that it started the War of Spanish Succession, which lasted around 10 years. By the time it had finished in 1714, Philip had become Philip V of Spain, and Spain had lost most of its European territories. Philip was a good administrator and he promoted good politics in Spain, although his strict foreign policy took Spain to many costly wars to try to regain the lost lands.
The unification of Spain in the Enlightenment also took place during Philip's reign. In reprisal for having opposed him during his ascent to the throne, he abolished the fueros in Aragon and Valencia and imposed the Fuero of Castile. Gradually, the Cortes of Castile gained more power until they became the Spanish Cortes. However. Philip allowed Navarre and the Basque provinces to retain their fueros for their loyalty.
Philip V died in 1746, and the throne was passed to Ferdinand VI, his son. Ferdinand was a good king and he tried to keep everyone happy. Together with Ensenada, which had served his father, and Carvajal, he improved Spain's communications and roads, and encouraged ship-building and the development of science. Ferdinand died in 1759, stricken by the grief of his wife María Barbara de Braganza, who had died a year before.
Ferdinand was succeeded by Charles III, son of Philip V. Charles III had been named Duke of Parla by his mother when he was 16, so he had previous experience in government. He was a huge promoter of the Enlightenment despotism, a way of reigning which was more relaxed than the regular despotism. These monarchs tended to accept different religions, freedom of speech and even the press, and they fostered the arts, education and sciences. Charles III had the help of many important ministers, and without straying too much from the Old Regime he modernized the country, repopulated Sierra Morena (near Seville) and helped to promote education and trade.
The Church had always been well treated by the Spanish monarchs, particularly by Philip IV, who had given them large portions of land. Most of this land was left unused, and as the population grew and the system became obsolete, the government was pushed to reform. Spain had a lot of nobility and aristocracy who lived mainly off the land, and who had grown accustomed to "the good life". The Enlightenment in Europe had been an anticlerical force, and Charles III though this would work in Spain. He completely expelled the Jesuit Order from Spain in 1767 and the Spanish Inquisition was scaled back, but it didn't disappear until after 1787. The reforms imposed by the king alienated the clergymen and the gentlemen who lived off their lands, and Charles allied with the merchants and the ever growing middle class that during his ruling found a new wealth. The king also reduced the border taxes and liberalized the grain trade in 1765.
Charles III died in 1788 and was succeeded by Charles IV. The French Revolution broke out in 1789, and with it came the crumbling of everything Spain had been working for in the last few decades. The French Revolution brought fear and censorship to Spain. After the execution of Louis XVI, the war against France began. The French crossed the Pyrenees into Spain but Charles IV signed a treaty with them (the Basel Peace) and gave them half of the island of Santo Domingo in exchange for the territories they had taken near the Spanish Pyrenees. England said Spain had betrayed them and attacked the Spanish fleet. When Spain tried to remain neutral in the conflicts between France and England, Napoleon demanded compensations for it, and the wars continued. Charles IV gave the throne to Ferdinand VII, whom Napoleon forced to give the crown to his brother Joseph, who then became Joseph I of Spain.
Spanish gained importance during the Enlightenment, and its correct use was promoted with the creation of several organs like the Real Academia Española.