Debate continues
The project had already been approved by Uruguay's lower house in July.
It had also drawn international criticism. The International Narcotics Control Board (INCB) warned the law would "be in complete contravention to the provisions of the international drug treaties to which Uruguay is party".
The INCB is an independent body of experts established by the United Nations to monitor countries' compliance with international drug treaties.
The historic approval comes amid growing debate over drug legalisation in Latin America.
A group of former presidents and influential social figures, including Brazil's Fernando Henrique Cardoso, Mexico's Ernesto Zedillo and Colombian ex-leader Cesar Gaviria, have called for marijuana to be legalised and regulated.
But President Mujica recently asked during an interview why the former leaders only spoke out about the legalisation of marijuana after they had left office.
In July, without naming Uruguay directly, Pope Francis criticised drug legalisation plans during a visit to Brazil.