Mexico's lower house has approved a bill that would legalise the recreational use of cannabis.
It will now go to the Senate for a final vote, which President Andrés Manuel López Obrador's party is confident will pass.
This would make Mexico one of the world's largest regulated markets for cannabis.
Mexico has struggled with a bloody war against powerful drug cartels, with violence killing thousands yearly.
Lawmakers voted in favour of the bill by 316 votes to 129. It had already been approved in the Senate in November but another vote is needed following some alterations by the lower house.
The legislation would let users with a permit carry up to 28g and grow as many as eight plants at home for personal use. At present, it is illegal to carry more than five grams.
It would also allow for other licences for the cultivation, transformation, research and export or import of cannabis, Reuters news agency reports.
Mr López Obrador has argued that the bill could help tackle the country's powerful drug cartels.
One lawmaker from his Morena party told AFP news agency that the law would help to achieve peace.
However critics have argued that the bill could make marijuana more accessible to children. Others have questioned why Mexicans would be able to buy as much alcohol as they like, yet be liable for prosecution if they grow more than eight cannabis plants.
Should the bill be approved, Mexico would become the third country in the world, after Uruguay and Canada, to legalise cannabis for recreational use nationwide.
A number of foreign cannabis-growing companies from Canada and California are said to be interested in tapping into the market opportunity presented by the legislation.