The bill fell short of demands among some critics who argued that wider legalisation could help the country to reduce drug-related violence.
The historic move would “lay the foundation to establish in our country an industry for the national production of medicines with cannabis,” Sen. Cristina Diaz of Pena Nieto’s centrist Institutional Revolutionary Party, said.
Sen. Angelica Gomez of the Party of the Democratic Revolution, said there was consensus “to do something different in drug policy”.
Gomez noted that prohibition had generated high levels of violence, more than 100,000 deaths and the systematic violation of human rights.
In a statement summarising the debate, the Senate said the Health Department had been directed to “design public policies to regulate the medicinal use of cannabis and its derivatives.”
This includes tetrahydrocannabinol (THC), the plant’s main psychoactive ingredient.
It also would establish that industrial products with concentrations of one per cent THC or less would be legal to buy, sell, import and export.
The cultivation of marijuana for medical and scientific purposes would henceforth
not be punishable.
A family in northern Mexico became a symbol of the push to legalise medical marijuana in 2015 when the parents of a young epileptic girl won a court battle to import a cannabis-based treatment to stop her daily seizures.
In a separate major case in November 2015, the Supreme Court authorised four individuals to grow and smoke marijuana for recreational purposes.
The bill will now move to the lower Chamber of Deputies for consideration.