Two other scenarios, one more related to this one than the other.
1: No Peninsular War. Instead an enlightened Spanish king declares all Christians legally equal. Instant criollo rebellion? And what happens afterward?
2: The Latin American colonies still revolt, and because of the OTL Peninsular War. However, the King of Spain, in desperation in the late 1810s, decides to declare all Christians equal and try and get the support of non-criollos against the revolutionaries.