Except that we’re talking some 430 years ago and I would cut them some slack because knowledge of economy was nothing like it was today and the mentality on all other things was totally different. To be meaningful any judgment has to be made against the standards of the time.
Spanish history of that period is one of my favorite reading topics but I do not want to get too deeply involved in this thread. Pretty much all empires decline for the same reason: They wish to maintain a position which is financially unsupportable and they do it for a short while (in historical terms) by going into debt and then everything collapses. Only a crisis like that will make people accept their new position in the world and, as you say, America today is a good example.
The decline of the Spanish empire is a very complex topic and all simple answers are going to leave a lot of important things out. Furthermore, most simple answers are going to be Anglo textbook simplifications of the sort which make Spain look bad and the Anglos look good. Like “they didn’t want to work, only steal gold, and that was their downfall” with the implication “and we didn’t steal gold but rather worked and that’s why things went so much better for us”. Which is patently nonsense. Complex questions require complex answers. Or you can just say of any empire that it declined due to “getting into idiotic wars they couldn’t afford”.
Let’s begin with something very basic. There was no such thing as “Spain” at that time. There was Castile and Aragon, two separate and distinct kingdoms, with their separate laws and customs, in personal union. Castile was by far the richest of the two and it was Castile which undertook the discovery and conquest of America while Aragon had nothing to do with it and focused their energy in the Mediterranean conquering Naples and other parts. So that is the first crucial thing to understand.
As I said, Castile was the richest kingdom in western Europe in its own right. It had high production of cereals, wine, wool and other goods. It is nonsense to say “Spain” was only rich from the gold it got from America.
One crucial point is that the population of Spain took a big hit in trying to populate the Americas. Spain’s population was being bled to death. Later empires had a higher population to work with and populated places more slowly.
Another crucial point in understanding the decline of Spain is that governments of centuries ago did not have the kind of effective control governments have today. Their sovereignty and control were mostly symbolic, even in the metropolis but extremely so in the colonies.
The King of Spain could issue as many decrees as he liked but there was damn near little he could do to enforce them effectively. A matter submitted to the crown from South America could take a year or more to receive a response and often when the royal order came the local authorities, always ostensibly acting in the name and interest of the king, would “submit to it but not enforce it” (se acata pero no se cumple) as the formula went.
In the early 19th century two crucial things came together. The ideas of the enlightment which spread across Europe and then maerica like wildfire and the Peninsular wars which decapitated for some years the Spanish Empire. These two factors came together in the South American colonies to create the conditions for independence movements which are a close copy of what happened some years earlier in North America.
As I say, it is an incredibly complex subject which would fill pages and pages. I just recommend reading about it. A lot.
I would point out that the it seems such a question is asked there is an implication that if things had been done differently Spain could have remained powerful longer. Maybe or maybe not. The same can be said for any empire. A hundred years from now people will be asking about the stupidity of some American wars and military expenses and how they were a factor in the downfall of the USA. But with or without stupid policies every empire will decline, it is just a matter of controlling the rate of the decline.
In this sense I think the British have been the more judicious and least bad. On the whole they have managed to adapt to their declining power and influence and not try to hang on with wars to unsustainable colonies. They have managed on the whole to maintain rather good relations with their ex-colonies.