It would be the first with such a strong underworld to take that step
A garden of marijuana leaves outside the Senate have been tended to by pro-legalisation activists
The Senate said the bill’s objective was to reduce organized crime by shrinking the illegal drug market.
The bill must be approved by the lower house by mid-December to become law.
If passed, the bill would mark a change of approach to drugs for the country.
Mexico has long struggled with a bloody war against powerful drug cartels, with violence killing tens of thousands of people every year.
But public opinion about legalization in Mexico has shifted in recent years, reflecting a growing sentiment in Latin America and elsewhere that the current prohibition on drugs should change.
In a landmark ruling, Mexico’s Supreme Court opened the door to the recreational use of marijuana in 2018.
The court effectively overturned the ban on using cannabis recreationally, but it still remains illegal to carry more than five grams (0.18 ounces) of the drug.
The bill passed by the Senate would change that, paving the way for the creation of one of the world’s largest lawful marijuana markets.
Should the bill be approved, Mexico would become the third country in the world, after Uruguay and Canada, to legalize cannabis for recreational use nationwide.
In addition to decriminalizing the recreational use of cannabis, the bill would allow for the drug to be used for scientific, medical, and industrial purposes.
What have supporters and critics said about the bill?
There was a passionate debate in the Senate, where the ruling left-wing party of Mexican President Andrés Manuel López Obrador holds a majority.
Outside the Senate, a garden of cannabis in a nearby public park has become a rallying point for pro-legalization activists.
Supporters of the bill say accountable state regulation of the drug will undermine the link between organized crime and the cannabis trade.
The bill passed in Mexico's Senate by a large majority
More on Mexico's war on drugs:
Green Party Senator Raul Bolaños told the chamber the legislation was long overdue and served Mexico’s best interests.
“The day has come, after two years of hard work in this Senate, we will be able to end 100 years of unnecessary prohibition,” he said.
“In these two years of work, we have come to a verdict which allows for the free development of character, for the health of Mexicans, and for the well-being of the entire nation.”
But critics argue the bill could make cannabis more accessible to children and cause health problems.
Damián Zepeda Vidales from the National Action Party opposed the move on those grounds.
“When we are going to vote for a reform, we should always ask ourselves whether it is going to bring something positive to the country or not,” he said.
“Without a doubt, in this case, we feel it won’t. We don’t think it’s positive that it will be accessible to youngsters and also children.”