Canadian senators have passed the Cannabis Act by 56 votes to 30 with one abstention after studying the landmark legislation for six months.
Prime Minister Justin Trudeau has committed to making marijuana legal by this summer. This makes Canada the first G7 nation to legalise recreational use of the drug.
The use of medical Marijuana has been legal in Canada since 2001 and it is grown by federally licensed producers.
The vote that was cast on Thursday sends the bill back to the House of Commons, where members of Parliament will decide whether to accept the dozens of amendments added to the legislation by the Senate.
The vote had been expected to be close, and the Trudeau government moved on Wednesday to shore up support by assuring indigenous senators it would address significant concerns they had with bill.
That included committing more resources to mental health and addiction services for indigenous people in Canada. Canadians will still have to wait up to 12 weeks after the bill finally becomes law before they can purchase recreational cannabis.
Provinces and territories are responsible for various elements of the retail market, including how marijuana will be sold and whether users can smoke in public. They are expected to need that time to set up the new marketplace.
Mr Trudeau’s promise to legalise recreational marijuana has fuelled investment and speculation in the cannabis sector, with cultivators like Aphria and Canopy Growth becoming stock market darlings.