Although gay marriage is already legal in seven provinces, the bill now grants all same-sex couples in Canada the same legal rights as those in traditional union between a man and a woman.
The Netherlands and Belgium are the only other nations that allow gay marriage nationwide.
The legislation, drafted by Prime Minister Paul Martin's minority Liberal Party government, was expected to easily pass through the Liberal-dominated Senate and become federal law by the end of July. It was the last major piece of legislation before Parliament recessed for summer and comes on the first anniversary of Martin's leadership.
Some of Martin's Liberal lawmakers voted against the bill, and his Cabinet minister for economic development in Ontario, Joe Comuzzi, resigned Tuesday over the contentious legislation. But enough allies rallied to support the bill that has been debated for months.
Martin said he regretted losing Comuzzi, but he hailed Tuesday's vote as a necessary step for human rights.
"We are a nation of minorities," Martin said. "And in a nation of minorities, it is important that you don't cherry pick rights. A right is a right and that is what this vote tonight is all about."
There are an estimated 34,000 gay and lesbian couples in Canada, according to government statistics.
"This is a victory for Canadian values," said Alex Munter, national coordinator of Canadians for Equal Marriage, a group that has led the debate for the legislation.
Martin, a Roman Catholic, has said that despite anyone's personal beliefs, all Canadians should be granted the same rights to marriage.
Churches have expressed concern that their clergy would be compelled by law to perform same-sex ceremonies, with couples taking them to court or human rights tribunals if refused. 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.
The Roman Catholic Church, the predominant Christian denomination in Canada, has vigorously opposed the legislation, as well as major Islamic and Sikh orgnaizations whose members believe the law would rock the foundations of traditional family.