It’s a bit of elementary economics that people always tend to miss. Gold, silver, etc., are valuable simply because they are relatively scarce, stable, and fungible. When Spain started importing gold from the New World, it increased the available quantity of gold by a significant factor (2X? 3X? I don’t know precisely what – but it was not a low 1.00001X sort of figure).
It’s the distinction between money and wealth. Twice the amount of money representing the same amount of wealth inflates – becomes half the value-per-currency unit it had been. If a car salesman in 1960 buys a $100,000 house by collecting 10% commission on the sale of 100 new cars @ $10,000 – and today his house is “worth” $350,000 but the price of a new car is $35,000 – the only thing that has changed is the value of the dollar; his house is still equivalent to the cost of 10 new cars, or the commission on sale of 100.
Spain had a lot more gold, temporarily equivalent to a lot more money. But it had virtually no added wealth. And when the value of gold dropped, so did Spain’s national gross worth.
The Spanish Empire was governed indifferently, generally for the benefit of the mother country but with the occasional sop to local interests and the occasional reformer. Net result was that there was minimal loyalty to Spain at the turn of the 19th Century – and a great deal of idealism and complaints about misgovernment by the Viceroyalties, Captaincyies General, etc.
Revolts broke out in Mexico, Gran Colombia, Argentina, Chile… were put down and recurred. And in South America, at least, the various revolutionaries were smart enough to develop a flexible joint strategy. The fact that Spain was dealing with restoration of the Bourbons (Borbones south of the Pyrenees) after Napoleonic takeover, made things just that much tougher for the loyalists (mostly in Peru and Bolivia).
When all was said and done, what was left of the Empire was the Canary Islands, three of the Balearic Islands (they got Minorca back later), suzerainty over the Two Sicilies, Puerto Rico, Cuba, and the Philippines. And that was the Spanish Empire through the 19th Century.
Then Spain copped an attitude against the U.S. at a time when Manifest Destiny was a big deal, and William R. Hearst played up Spanish offensiveness to foment war fever in America. Result: the Spanish-American War, U.S. possession of the Philippines and Puerto Rico, and a brief hegemony over Cuba before it was given its independence at the beginning of the 20th Century.
Exit the Spanish Empire, whimpering.