The Spanish East Indies (aka the Philippines) are probably going to remain part of the united Hispanic America whether or not the Viceroyalties want it so - at the time it was easier for Manila to keep in touch with the outside world via Mexico City rather than Madrid. (And I'm not sure about Spain interfering with Russian America - I'm sure that St. Petersburg and Mexico City/the Escorial would come to an agreement on that.)
Having said that, having the Spanish court flee to Mexico City à la the Portuguese court to Rio de Janeiro would be an interesting idea. (I once considered concocting such an idea for a TL, so in that sense I kinda sorta know what I'm talking about.) To make it work, though, requires a complex series of interlocking parts that have to work just right, primarily involving Godoy as the power behind making the scheme work ahead of the Napoleonic invasion forces - and then forcibly leaving Godoy behind to deal with the consequences. IIRC the strategy I had come up with would basically be as follows:
We all know of Godoy's affair with Maria Luisa, and how Charles IV was basically an incompetent SOB who closed his eyes to the affair until it was too late. However, perhaps that affair could be used to the Spanish royal family's advantage, turning it into something worthy of a telenovela? This would involve a 19th century POD around the same time as, say, the failed British invasions in the Río de la Plata (so, about 1806-7). Ironically, despite the invasions, at the time Britain and Spain were allies - this even if we take into account the British blockade and the disaster of Trafalgar, with the Prime Minister - Godoy - looking for any way to get Spain out of its current mess. Now, IOTL the Mutiny of Aranjuez took place in 1808, while the Royal Family were fleeing southwards (anticipating a French invasion), which ultimately turned into a disaster, with Charles IV abdicating, his son Fernando VII becoming king, and Godoy led off to his fate. However, if we tweak that event so that the Royal Family (and whoever else at court wants to hitch a ride) scurries out of Spain and on their way over to Mexico City via Veracruz with a stopover either in Havana or Puerto Rico, perhaps we could get somewhere. So, let's say the whole thing goes as follows:
>We'll be basing it around the Aranjuez mutiny, but instead of OTL let's bring it up one year early - to 1806/7. So it would be close to around the time of the invasions of the Río de la Plata. Now, of course, there's the right way to bring the news forward, and there's the wrong way to bring the news forward. Let's just say, to make it easy, that the news gets bungled (as one would know from the telephone game). Whether the news happens before or after the following events, I leave it up to you.
>Back in Europe, let's say Fernando wises up and not becomes an ass of himself. When Nappy asks Charles IV for troops, his son tells him that it's basically a figleaf for the French conquest of Spain. This of course Charles denies - but then it gets worse as Fernando compares France's pretext with Godoy's trysts with the Queen. A violent discussion ensues, and Fernando departs. Of course, this would be before The Conspiracy (TM) is discovered. Having that "discussion" with Fernando, Charles IV goes over to Godoy, begging for help. Now, normally Charles would be acting like a spineless maggot, but in this case he apparently gets the courage to bypass the Queen. Now, we pretty much know that Godoy and Maria Luisa - the Queen - were lovers, and apparently, so does Charles IV - since he confronts Godoy about their trysts. This, obviously, puts Godoy in a difficult position, so he comes up with a face-saving plan to try to not only save Charles IV's back, but to bring down Fernando and shore up Godoy's position. As in OTL, this involves getting the Royal Family to Aranjuez. Eventually, they all move down to Seville (in secret), then to Cádiz, then out onto the high seas (with a planned stop in the Canaries, just to get supplies before moving on to América). Meanwhile, Godoy would stay behind, expose the Conspiracy, and if the Royal Family made it to the Canaries during the intervening time, they go right back to the Peninsula and pretend nothing happened.
>>What's The Conspiracy, you ask? Basically despite Fernando and his supporters much rather preferring a more closer relationship with the UK, there were rumors that Fernando had the backing of Nappy. Things snowballed from there where Fernando would overthrow his own father and become King himself.
>The Queen, naturally, refuses, but Godoy 'fixes' her up on that (

). So, according to the plan, the Royal Family and the Court temporarily move to Aranjuez (under the pretext of the King being ill and needing some rest/change of climate or the pretext of the Escorial getting much-needed repairs - I'll let you decided), but it does not mean an abdication. They stay in Aranjuez for a few days. So far, so good, no problems yet.
>Meanwhile, having realized his father won't change his mind, Fernando tries to flee to Mexico with his supporters - or at least tries, because as with everything else in his life he bungles this one and its execution is very incompetent. Which divides his supporters considerably. Eventually, he decides to stay and not flee to Mexico, due to pleas from his supporters. He just bides his time - but time is short. Fernando is pretty much, at this point, still scheming with the French, and he gets caught in the act.
>At the same time - in secret, under the watchful eye of Godoy, nonetheless, and in disguise - the Royal Family and a good-sized portion of the court make the move south. (If one wanted to go over-the-top, albeit un-king-like, and make it look like a telenovela, then instead we'd use a different tack. That is to say - wax or lead figurines of the King and Queen are in place at their bed in their place, leading some to believe that they both have died. If Carlos IV had any health problems that were known at the time, then this could be exploited. Thus, we would normally expect to have the massive state funeral in Madrid and the like, as with any other royal death. As this would seem weird, though, I would caution against using this unless one wants to land a writing job with the Azcárragas.) Godoy somehow tries to alert the royals of Fernando's plans, which exposes the Conspiracy. The message might have gotten to the royals, but it is too late as Godoy is exposed - if the message got to the royals [probably along with the news of Godoy's arrest], the missus decides "enough is enough" (living up the King's reputation of being a 'spineless maggot' and the Queen having to make decisions for him) and the Royal Family/sympathetic elements of the Court thus leave for Cádiz and the New World - unknown to most people until Godoy's plans are exposed.
>Around the same time, we have the Aranjuez mutiny - remember, we're still in 1807, so it's one year early and probably around the spring/summer - and thus the mutiny is accelerated. Godoy gets arrested on any number of charges and is sent to jail. His palace gets trashed and set on fire. Those members of the Royal Family and court who are willing make haste their flight to the New World. That way, when people try to go after Charles IV, he's already on the boat from Cádiz and onwards towards the New World - along with the Queen, the Infante Carlos, and the Infante Francisco de Paula, and others. Naturally, the planned stop at the Canaries never happens. However, they do land in either Havana or San Juan de Puerto Rico, then onwards to Veracruz and then to Mexico City.
>Of course, the stresses of making the trans-Atlantic voyage puts a heavy strain on Charles IV, shortening his lifespan and dies within the first couple of days upon arrival in Veracruz. His son, Charles V, therefore, becomes the new King - but then again, so does Fernando, back in Spain proper (so we have
two Kings of Spain). From there, words spreads throughout the New World as fast as it can, having much of América back Charles V - not by sea power, but by reaffirming their loyalty to God, the King, and Spain in a feudalesque manner.
>The main vector in making all this work according to plan, therefore, is the timing. As timing is critical, all the preceding events have to be timed right for the ruse to be pulled off. Say that it takes about a day from Madrid to Aranjuez, hence ~8-10 from Madrid to Seville and another three days to Cádiz. In the end, therefore, we still have Charles IV, most (if not all) of the Royal Family, and most (if not all) of the Spanish Court fleeing to Mexico - enough to keep the Spanish state functioning more or less in one piece, even in exile. Except Godoy - Godoy's staying behind, and who ironically becomes one of the few people where in Mexico there are streets/plazas/monuments named after him for what he did. In this case Godoy sends the royals ahead of him with the expectation that he would join them, but of course even the best-laid plans have problems - his arrest being one of them, done of course by Fernando's supporters.