Uruguay has become the first country in the world to legalise the production and sale of marijuana.
The bill legalising marijuana was approved 16-13 in the Senate and will come into effect from the next year.
The law, which stipulates the regulation, distribution and sale of marijuana in the South American nation, is intended to curb the thriving illegal trade of cannabis.
Although the possession and use of marijuana have been legal in Uruguay, its cultivation was prohibited.
"Uruguay has taken a step forward. We'll see how it works, and we'll continue looking for solutions," said Senator Luis Rosadilla of the ruling Broad Front Party.
Dozens of campaigners who are lobbying for the bill to be passed gathered outside the Congress, cheering the vote.
The move is being closely watched by other nations which are also wrestling with illegal drug trafficking.
Buyers, aged above 18 and Uruguayan residents, will be able to buy 40g of marijuana from the registered chemists each month. The purchases will be monitored by the government.
The law also allows Uruguayans to grow six marijuana plants a year. The cannabis clubs, with a maximum of 45 members, are allowed to grow up to 99 plants. A separate monitoring body will be set up by the government in the next 120 days to regulate the sale and consumption of cannabis.
"We know this has generated an international debate and we hope it brings another element to discussions about a model [the war on drugs] that has totally failed and that has generated the opposite results from what it set out to achieve," said Julio Bango, an Uruguayan politician involved in the drafting of the bill.
However, critics have said the law will eventually expose more people to drugs.
"This project envisages a social engineering experiment and respects none of the ethic safeguards of experimentation on human beings, and these are important in the case of a substance like marijuana, which causes damage to human beings," opposition member Alferdo Solari told Reuters.
The government has said the law shall be rescinded if the legalisation proves counter-productive.