Teachers and supporters of the the National Coordination of Education Workers (CNTE) protest against proposed education reforms on Reforma Avenue in Mexico City on Sept. 4, 2013. (Susana Gonzalez/Bloomberg)

Lawmakers approved a major overhaul of Mexico’s public education system early Wednesday, giving President Enrique Peña Nieto a crucial victory in his drive to fix some of the country’s most dysfunctional institutions.

Mexican senators voted 102 to 22 for a package of measures that will establish a standardized testing system for evaluating teacher performance and hiring faculty, ending the corrupt practices that allowed union bosses to buy and sell classroom jobs and pad their pockets at the expense of students.

The Senate vote followed approval of the measures by the lower house of Mexico’s Congress on Sunday by a similarly broad margin, 390 to 69.

The stranglehold of teacher unions on Mexico’s public education system has long been viewed as a major drag on the country’s economic and social development. Mexico spends a greater share of its public funds on students than most industrialized nations, yet it produces the lowest academic achievement levels. Fewer than half of Mexican students finish high school.

Meanwhile, millions in public education funds are siphoned off for the salaries of union officials, many of whom rarely set foot inside a classroom, if ever. Even Mexican drug lords have turned up on teacher payrolls.

“The inheritance and sale of jobs has ended,” Education Secretary Emilio Chuayffet tweeted after the Senate vote. “Merit is the ideal means of access to, and progress in, a teaching career.”

Angel Díaz Barriga, an education expert at Mexico’s National Autonomous University, said the fundamental achievement of the overhaul will be to reestablish the government’s control over public education, decades after the ruling Institutional Revolutionary Party handed it over to union bosses in exchange for political patronage.

“From now on, it will be the Mexican state that determines hiring, competency and professional promotion of teachers, and that’s an important step,” Díaz said.

Despite the Senate vote, marching teacher union members continued to besiege downtown Mexico City, blocking traffic and bringing total gridlock Wednesday to the already congested streets.

The National Education Workers’ Coordinator, the second-largest teacher union in the country, has bused in thousands of members, many from poor southern states, to protest the overhaul. Striking teachers marched in at least a dozen other Mexican states, saying the changes are being imposed on them from above. In the capital, union leaders called for “insurrection” and said teachers would continue to occupy Mexico City, demanding a meeting with the president.

The union is also threatening to join demonstrations this weekend planned by leftist former presidential candidate Andrés Manuel López Obrador in opposition to Peña Nieto’s plans to overhaul the government-run oil monopoly, Pemex.