Carlos II, the last of the Spanish Hapsburg, left no direct descendants, but named as his successor a grandson of his sister Maria Teresa and Louis XIV of France, Felipe of Anjou. Crown as King of Spain and the Indes, Felipe V was the first Spanish Bourbon King inaugurating with his reign the Spain of the Enlightenment, an epoch of hamonious foreign relations, reform and interior development.
The reign of Felipe V can be deivided into three clearly different phases: first, that of tutelage from France, then independence, and finally, that of an equilibrium with the great neighbouring nation.
1759 to 1788: During the reign of Charles III, the policies of the Primer Minister, Floridablanca, kept Spain out of the conflict in spite of a cautious intervention in the American War of Independence. Charles III carried out a profound reorganisation of the nation, reformed its agriculture and introduced the very latest in urban concepts from his native Naples. This was the time when Madrid was transformed from just another town in La Mancha into a modern city, replete with elegant buildings on a par with Paris, Milan and Naples. It was equiped with running water, a sewage system, street lighting and a court of great style and splendour.
Although there was considerable resistance to the introduction of new concepts at grass roots level, the nation's intellectuals were receptive to the ideas of the Enlightment and of Diderot's Encyclopedie. Spain began to produce architects, engineers, geographers and naturalists. Later, the democratic ideas engendered by the French Revolution were to reach Spain, though not to be adopted by the ruling or political classes.
After a brief period of enforced alliance with France, which cultimated in the British defeat of a Franco-Spanish fleet at Trafalgar, Napoleon's troops invaded Spain. The bloody six-year war which followed - the Peninsular War, known in Spain as the War of Independence - in which guerrilla tactics and a scorched-earth policy were applied, dealt a death blow to the Spanish economy.