Mexico's Senate on Wednesday approved controversial legislation to open the state-controlled energy sector to foreign investment and break the 75-year-old oil monopoly.
The bill is the centerpiece of President Enrique Pena Nieto's reform drive, which has included new tax collection, telecommunications and education laws in an effort to revitalize Latin America's second biggest economy.
The legislation would let private firms explore and extract oil and gas as well as share profits, production and risk with the state-run energy giant Pemex, ending a ban cemented in the constitution.
Pena Nieto wrote on Twitter that the vote was "a significant decision for Mexico" that would allow the country to "make the most of its resources to grow economically and create jobs in the coming years."
The Senate voted 95-28 for the general outlines of the bill in a midnight vote before approving the details in an all-night session that ended early Wednesday.
The bill now moves to the lower chamber of deputies, where supporters have a majority. If it passes Congress, the reform will have to be approved by 17 of Mexico's 32 federal entities.
The proposed constitutional changes stem from a deal between Pena Nieto's centrist Institutional Revolutionary Party (PRI) and the conservative opposition National Action Party (PAN).
The two parties say the reform is badly needed to modernize Pemex and reverse falling oil production.
"In a historic session, we have set the basis for a new model for Mexico's energy sector," David Penchyna, president of the Senate's energy committee, wrote on Twitter.
But the left-wing Democratic Revolution Party (PRD) has branded the plan treason and a submission to US oil companies, calling the legislation a bid to privatize a symbol of national sovereignty.
Protesters have camped out outside the Senate, hitting metal police barriers with shoes, sticks and rocks.
The PRI insists the oil would remain in the nation's hands.
It says the reform is needed to reverse a downward trend in oil production, which has dropped from 3.4 million barrels per day in 2004 to 2.5 million bpd today.
The bill proposes contract and licensing schemes that fall short of more controversial concessions.
The legislation also would remove Pemex's powerful union, which has been tainted by corruption allegations, from the company board.
Changes to the oil sector strike at the heart of modern Mexico's national identity.
In 1938, then president Lazaro Cardenas nationalized the foreign-operated oil industry, a wildly popular move that asserted Mexico's right to its own mineral wealth.
The government also founded Pemex, which despite its many problems remains one of the country's most important sources of income from exports.