Miguel Hidalgo, Guanajuato's rebel leader turned national hero, got the cause started in nearby Dolores with his Grito de Independencia (Cry for Independence), a call for insurrection against Mexico's high and mighty. Guanajuato's citizens - or "Guanajuatenses" - joined the independence fighters against Spaniards and Spanish loyalists, first seizing the Guanajuato's famous Alhóndiga and later the whole city. Granted, Spaniards would eventually retake the city, avenging their earlier defeat by instituting the famous "lottery of death"- a twisted contest in which citizens' names were drawn at random, and the "winners" were tortured and hanged.
Nevertheless, the rebellion's taking of Guanajuato was still the first signficant victory in what would become an 11-year effort. Unfortunately, in 1811 Hidalgo was caught by the Spanish and went on to meet a rather untimely death. Picking up the reins was José María Morelos Pavón, who assumed leadership of the rebellion. He would unfortunately meet a fate similar to that of fellow rebel Hidalgo.
Following the deaths of the cause's two most significant leaders, the final six years (1815-1821) of the quest for independence was carried out primarily by guerrilla fighting. In that final year, 1821, Spain itself was dealing with political and economic crises and was unable to control the situation in its colonies abroad. So, 11 years of fighting came to an end with the Treaty of Córdoba, which officially recognized Mexico as an independent state.
Continue: Modern History of Guanajuato, Mexico