Supreme Court Chief Justice Beverley McLachlin signed the legislation making it law, hours after it was approved by the Senate late Tuesday night despite strong opposition from Conservatives and religious leaders.
The bill gives homosexual couples the same rights as those in traditional unions between a man and a woman, something already legal in eight of Canada's 10 provinces and in two of its three territories.
The legislation drafted by Prime Minister Paul Martin's minority Liberal Party government easily passed the Senate, which essentially rubber stamps any bill already passed by the House of Commons, which passed it late last month.
The Netherlands, Belgium and Spain are the only other nations that allow gay marriage nationwide.
The law comes after years of court battles and debate that divided families, religious groups and even political allies. The Roman Catholic Church, the predominant Christian denomination in Canada, has vigorously opposed the legislation.
But Martin, a Roman Catholic, has said that despite anyone's personal beliefs, all Canadians should be granted the same rights to marriage.
Alex Munter, national spokesman for Canadians for Equal Marriage, which has led the debate in favor of the law, was triumphant Wednesday: "It is a signal to the world that Canada is an open and inclusive society that believes in the notion of full citizenship for all."
Churches have expressed concern that their clergy would be compelled to perform same sex ceremonies. The legislation, however, states that the bill only covers civil unions, not religious ones, and no clergy would be forced to perform same-sex ceremonies unless they choose to do so.
Charles McVety, a spokesman for Defend Marriage Canada and president of Canada Christian College, said he was "very sad that the state has invaded the church, breached separation of church and state and redefined a religious word."
McVety vowed his group would work to vote out lawmakers who supported the legislation in the next general elections.
"A new Parliament is going to readdress this issue and common sense ultimately will prevail," McVety said.
In the United States, Massachusetts is the only state that allows gay marriages; Vermont and Connecticut have approved same-sex civil unions.
Though hundreds of foreigners have come to Canada to seek civil ceremonies since gay marriages were first allowed in Ontario and British Columbia in 2003, not all countries or states recognize the unions.
The U.S. government does not recognize same-sex marriage, and most states refuse to acknowledge marriage certificates from gay and lesbian couples, regardless of where they wed.