Fighting soon broke out between juntas and the Spanish colonial authorities, with initial victories for the advocates of independence. Eventually these early movements were crushed by the royalist troops by 1812, including those of Miguel Hidalgo y Costilla in Mexico and Francisco de Miranda in Venezuela. Under the leadership of a new generation of leaders, such as Simón Bolívar “The Liberator”, José de San Martín of Argentina, Bernardo O’Higgins of Chile, and other Libertadores in South America, the independence movement regained strength, and by 1825, all Spanish America, except for Puerto Rico and Cuba, had gained independence from Spain. Brazil achieved independence with a constitutional monarchy established in 1822. In the same year in Mexico, a military officer, Agustín de Iturbide, led a coalition of conservatives and liberals who created a constitutional monarchy, with Iturbide as emperor. This First Mexican Empire was short-lived, and was followed by the creation of a republic in 1823.
Haiti, sometimes counted among the Latin American nations
By the end of the eighteenth century, Spanish and Portuguese power waned on the global scene as other European powers took their place, notably Britain and France. Resentment grew among the majority of the population in Latin America over the restrictions imposed by the Spanish government, as well as the dominance of native Spaniards (Iberian-born Peninsulares) in the major social and political institutions. Napoleon's invasion of Spain in 1808 marked a turning point, compelling Criollo elites to form juntas that advocated independence. Also, the newly independent Haiti, the second oldest nation in the New World after the United States and the oldest independent nation in Latin America, further fueled the independence movement by inspiring the leaders of the movement, such as Simón Bolívar of Venezuela, José de San Martín of Argentina and Bernardo O'Higgins of Chile, and by providing them with considerable munitions and troops.