any POD of an infant surviving, or a better one is born instead, is a start. you can write the story any way you want. However, the overall society is still going to be the same, so outside of creating a hero leader who changes society simply through cult of personality, what really changes? From the time of Miguel, to the time of the first Bourbon King (Phillip V), the empire of Spain is a mish mash of Kingdoms where the common King is severely handicapped. Often the local elite were more powerfull than the King. Certainly, there could have been a line of better Kings, who pick better leaders, and which implement reforms in a rational manner which gradually transform the country, but until some semblance of strong central authority is established, it's hard to see a grand reformation, and sans your hero leader, it's hard to see the impetus which sparks a central authority.
Centralization occurred during the War of Spanish Succession, when France came in and installed a Bourbon King, and a Bourbon style of central gov't. Spain had been knocked down a lot during the dying days of the Hapsburgs (the last King being almost literally a drooling imbecile) and during the WOSS. But it still had a nucleus, and potential. It also had a mediocre (at best) King ruled by his second wife Elizabeth Farnese who was more interested in recapturing italian lands so her kids could have a place to rule than in improving Spain. Together, they blew the budget on war after war. Phillip abdicated at one point, but his son, Louis I, died almost immediately, so Phillip retook the reins. Switch the fate of the two, make Louis a competent ruler, with competent heirs, implementing needed reforms, staying out of war, and Spain can certainly have much improved fortunes.