Tens of thousands of teachers have demonstrated in Mexico City, many pledging to disobey an education reform passed by Congress and championed by President Enrique Pena Nieto.
Mexico's Senate overwhelmingly passed a sweeping reform of the dysfunctional public school system early on Wednesday, handing Nieto an important victory in his push to remake some of his country's worst-run institutions.
"The only way to defend what is being taken from us today is through mobilisation"
The Senate gave the nod to the final so-called secondary law of an education bill that regulates the tests that Nieto says teachers should take periodically to ensure they are up to standard. New teachers could lose their teaching jobs if they fail.The Lower House approved the bill on Sunday.
The Senate debated the issue on Tuesday evening and in the early hours of Wednesday morning voted 102-22 in favour of a standardised system of test-based hiring and promotion that would give the government the tools to break teachers unions' near-total control of school staffing.
That control includes the corrupt sale and inheritance of teaching jobs, and it has been widely blamed for the poor performance of Mexican schools, which have higher relative costs and worse results than any other in the 34-nation Organisation for Economic Cooperation and Development (OECD).
"The inheritance and sale of jobs has ended," Education Secretary Emilio Chuayffet said on Twitter.
The late-night vote clears a path for Pena Nieto to move forward with a series of even more controversial reforms, including a measure that would violate one of modern Mexico's longest-standing taboos by allowing private investment in the state-run oil company.
But there is potential trouble ahead.
Education advocates say a series of concessions to the National Education Workers' Coordinating Committee (CNTE), one of the two main teachers unions, undermined the reform's ability to create true change in the national education system.
"The only way to defend what is being taken from us today is through mobilisation," said Francisco Villalobos, a teachers' union leader while addressing protesters.
Reform advocates called the law an important first step, but said much more remained to be done in order to change the system.