Like the Portuguese court, what if and how, the crown were expell from Spain, by Napoleon and maybe the wars go on longer or a liberal revolution keeps them from returning and forces them to set their Empire in America? Were would make more sense to set their capital, Lima or Mexico city? Both are in pretty loyal and conservative viceroyalties (elite-wise). Tough places like Buenos Aires and Caracas are going to be problematic anyways thanks to the british comercial influence on the local elites, but they could be subdued with policies of autonomy and free or relaxed trade, hell, just eliminating the old peninsular monopoly may be enough.