The discrimination that the Spanish held against other races that lived among the land, eventually led up to protests and gatherings where people would talk together and figure out ways they can stop the spanish's sovereignty.
This led to great leaders including one by the name of Miguel Hidalgo y Costilla who was a Mexican priest who would ring his church bells to gather people to talk about the declaration of independence. Because of this act of being Included in figuring out solutions to accomplish the right for independence for him and everyone who was being treated unfairly, he was known in, ‘El grito de independencia’, (the cry for Independence) being known as one of the greatest leaders during such a situation.
Throughout the years, There would be more problems and excuses that the people could use upon them to support their demand for independence, even using it in ways that could n't count as treason against their own country.
People also tended to use the American revolution as excuse to use upon the Spanish eventually using it at Constitutions which would be a tactic that would later collapse because of the start of slavery.
Some major events that occurred with the Spanish was, Napoleon's reign. He was known as a man who gave people what they wished but still didn’t consider the fact of freedom of speech, people's voice in politics, press etc…. Seeming like a king that wants things gone in his own way, being selfish by not wanting to hear people's perception upon his rules. This was then used as a good excuse for the people to use against.
Finally after 11 years of people who proclaimed freedom from the Spanish, finally we're free. The treaty of Córdoba was signed by a Viceroy Spanish man by the name of Juan de O’Donojú. He signed the treaty that would officially let Mexico (or anyone that lived in that land), to finally become an independent state, atlas released from spanish restrictions and control.