The goal of the Latin American revolutions was precisely to gain independence from Spain.
This goal was achieved for all Latin American countries except for Cuba and Puerto Rico.
In South America, Simon Bolívar and San Martín liberated a share of countries, while independence for Mexico (New Spain) and Perú was more difficult because both countries were the most important Spanish colonies of the time.