He had been sickly and left no children. Fearing the dissolution of his vast holdings ranging from the Philippines through Italy and Sicily to North and South America, he, rather than accede to the partition of his empire by the European powers willed it in its entirety to the grandson of the most powerful man in Europe, the Sun King himself, Louis XIV.
“Be a good Spaniard—that is now your first duty; but remember that you were born a Frenchman, and maintain unity between the two nations; this is the way to make them happy, and to preserve the peace of Europe.”
Those were the words with which Louis XIV sent his grandson Phillip of Anjou to his new kingdom. Those words made the powers of Europe shiver, those words made possible the last great coalition of William III of England, they would strip the Sun King of his invincibility and set the islands of the British Isles on their path to global domination. It was an overarching objective of the foreign policy of the European states of the era to prevent “Universal Monarchy”, it was for many years represented by the Habsburg King, Charles V, and now it was seemingly about to be resurrected under the Bourbons whose “Ministers”, ironically had, putting matters of state above those of faith, prevented Habsburg success.
Phillip of Anjou was crowned Felipe V of Spain, at his coronation, the Spanish ambassador to the Versailles knelt and told his sovereign, “There are no more Pyrenees”. Safe to say that the rest of Europe was “not amused”.
Louis XIV in his quest for la gloire had made enemies of his neighbours and as the saying goes, the enemy of my enemy…
There was Leopold I the Austrian Habsburg, displeased at the loss of historically Habsburg territories to the hated Bourbons, Antonius Hensius, Grand-Pensionary of the United Provinces who once had his diplomatic immunity threatened by Louis’ Minister of War, meanwhile in England, the Dutch had pulled off a coup, sorry “Glorious Revolution” which saw the Francophile James II replaced by the Stadtholder of Holland, Zeeland, Utrecht, Gelderland, and Overijssel, William of Orange.
King Felipe V and Louis XIV did not calm the tensions with their actions. Louis refused to rule Felipe/Phillip out of the line of succession to the Bourbon Crown, to be fair, his heirs were dropping like flies at the time. His soldiers were belligerent, seizing border fortresses which exposed the Dutch Provinces to attack, the Dutch were wary of Louis invading them, again. The straw which broke the Camel’s back and the most pertinent point regarding your question, was Felipe V granting the Asiento, the monopoly contract for the shipping of slaves to Spain’s American holdings to the Compagnie de Guinée et de l’Assiente des Royaume de la France, which for us Anglophones translates to looks damn French!
The Asiento was granted in August, in September, England, the United Provinces, and Austria signed an alliance to war on France. On May 15, 1702, the war began. The war made the reputation and fortune of a certain John Churchill, an ancestor of the Churchill. How’s that for a hypothetical? It came to end with Britain victorious, and reluctant to help a Habsburg to Universal Empire, so it ended with Louis and Felipe agreeing never to unite the two Bourbon crowns. As the spoils of victory, Britain got Gibraltar, Newfoundland, and the Hudson Bay region, they also got the Asiento monopoly contract for 30 years.
The War of Spanish Succession weakened Spain, who would be distracted by further European wars. Her Atlantic commerce began a slow rejuvenation due to Ensenada reforms of King Ferdinand VI and the reforms of his son, Carlos III.
TL;DR: Spain didn’t stopped, they “outsourced” it to France and Britain.