From the absolute low power of the late 17th century, marked by military defeats, ruinous inflation, famine, earthquakes, epidemics, and a deformed and mentally disabled king, Spain managed under the Bourbon rulers to achieve stability and some economic prosperity again. The hapless Charles II died in 1700 and bequeathed the throne to Louis XIV's grandson Philip, launching Europe into 15 years of all-consuming war. When the dust settled, the Bourbons remained in power under condition that they never unite with the French throne. Spain also lost territory including Minorca and Gibraltar, as well as her Italian possessions.
Spain's navy remained a reasonably strong force under the Bourbons but the golden age of the 16th-17th centuries was over and it had been eclipsed on the seas by the Royal Navy. The vast colonial empire remained Madrid's lifeline and she took in far more wealth from the colonies than she gave back to them. The Argentine "plata" contained incredibly rich soil and produced almost triple the wheat crop that came from the barren Iberian peninsula--only the north of Spain was well-watered, the rest was a semi-desert whose fertility was only partially alleviated by canal construction. The Spanish nobility shunned industry and commerce; in earlier days the Moors had conducted most of that, now factories and mines were owned chiefly by English and German companies. Spaniards with energy and ambition emigrated to the colonies. A small middle class existed in the towns. Next to food, vast amounts of precious metals, minerals, and cash crops were produced from the colonies which also had triple Spain's population.