In 1500 Spain had a quite vibrant economy, with prospering mercantile, financial, agricultural and industrial sectors, certainly as compared to France or England of the time.
For a host of reasons these sectors all declined, not only as compared to competitors, but even absolutely, particularly after the mid-1600s.
There are literally dozens of reasons, so trying to nail down A or B as “the cause” is pretty much a waste of time.
Possibly the most important single cause would be the 80 Years War Spain engaged in to try to crush Protestantism and independence in the Netherlands, not to mention intermittently trying to enforce absolutism and absolutism throughout Europe (Armada, 30 Years War, etc.).
10 years of war in Iraq and Afghanistan has been a strain on our economy. The Spanish wars were at least an order of magnitude more difficult for its economy to handle and were pretty nearly continuous for a century.
It was more the social dislocation caused by emigration to the colonies and the banishment of the people who constituted the knowledge base.
They kept kicking people out because of their religion, or doubts about their religion.
BTW, Philip II had been King of England with Queen Mary. He was hardly isolated from world affairs and the currents of Protestant thought. His war against Nederlandish rebels would have happened even if they'd all turned into Recollect Friars.
Spain had this Democrat thing down pat ~ NO THINKING ALLOWED ~ just spend the money!
At the same time, with all the smart guys in the country somewhere else, many in the Americas, the colonies prospered, and by the time Philip II reached the end of his reign the smart guys had already prepared to establish a prime meridian in North America, and several baselines, for purposes of subdividing the continent, selling off the land to developers, and creating a new civilizatioin.
Fortunately Philip died and was replaced by his son Philip III, and he actually put that plan into place. Check the Treaty of London in 1604. That singular act made it possible for EUROPE to develop North America, which happened, and here we are.
BTW, Philip III was otherwise not terribly interested in government, and that was a good thing. His involvement in parties and socializing allowed Spaniards abroad to give up the fascist mailed fist.