President Enrique Pena Nieto has signed into law Mexico's most sweeping education reforms in seven decades.
The law, passed on Monday, seeks to change a system in which teaching positions can be sold or inherited.
"Professional merit must be the only way to be hired, remain and advance as a teacher, director or supervisor," Pena Nieto said after signing the law, accompanied by members of his cabinet and opposition leaders.
The legislation moves much of the control of the public education system to the federal government from the teachers' union, which has been led for 23 years by Elba Esther Gordillo. Under the old law, she hired and fired teachers.
No one knows exactly how many schools, teachers or students exist because the 1.5 million-member union controls the education system. No official census of schools, teachers and students is carried out.
The payroll is believed to have thousands of phantom teachers and once included the leader of a major drug cartel in the western state of Michoacan.
Another goal of the reform is to raise the level of Mexican students who complete middle school to 80 percent and the number who complete high school to 40 percent. The reform also extends learning hours in some 40,000 public schools.
The overhaul was Pena Nieto's first major proposal since taking office on December 1 and is considered a political blow to Gordillo, who has played the role of kingmaker for many Mexican politicians.
She was conspicuously absent from Monday's announcement and offered no immediate reaction. Gordillo has previously said she will fight to make sure the rights of teachers aren't hurt by the reform.