With the passage of the measure, Germany will join Ireland, France, Spain and other nations in extending full marital rights to same-sex couples, including the right to adopt children.
“If the Constitution guarantees one thing, it is that anyone in this country can live as they wish,” Thomas Oppermann, the parliamentary leader of the Social Democrats, said in opening the floor debate. “If gay marriage is decided, then many will receive something, but nobody will have something taken away.”
His remark was clearly intended to defuse the opposition of conservatives like Ms. Merkel who argued that the Constitution protected conventional marriage.
The chancellor explained her stance in a two-minute statement after the vote. She said that while she had come to support the right of same-sex couples to adopt, she continued to believe that marriage ought to remain a union between a man and a woman. What she did not want, she said, was a culture war over the issue.
“I hope that with today’s vote, not only that mutual respect is there between the individual positions, but also that an amount of social peace and togetherness can be created,” Ms. Merkel said.
Axel Hochrein, a board member of the Lesbian and Gay Federation in Germany who attended the parliamentary debate, expressed no bitterness toward Ms. Merkel, even though he had said Thursday evening that he thought she was leaning toward voting yes.
“This is perhaps part of her religious education,” Mr. Hochrein said of the chancellor’s vote. “I think it is more honest of her than to say yes. In the end, she fought for a long time against it, and always argued it was in her feelings, and this was a feelings decision.”
In contrast to Ms. Merkel’s no vote, several prominent members of her party supported the measure, including her chief of staff, Peter Altmaier, and the defense minister, Ursula von der Leyen, who has held several important posts in Ms. Merkel’s cabinets over the years.
To become law, the measure still requires approval by the upper house of Parliament and the signature of President Frank-Walter Steinmeier; neither appeared to be in doubt. Once the formalities are completed, Germany’s first same-sex marriages can be celebrated, probably some time in the early fall.
The legislative session on Friday was the last before Parliament’s summer recess, and the last before national elections in September. Heightening the emotion of the debate, several of the lawmakers who spoke are not standing for re-election, making Friday their final day in Parliament. Volker Beck, a Green Party legislator and longtime campaigner for gay rights, is retiring, and he was close to tears as he spoke to reporters after the vote.
Same-sex couples in Germany have been able to form civil unions since 2001, and opinion polls have shown for years that most Germans favor legalizing same-sex marriage. But until this week, conservatives had consistently prevented the issue from coming to a vote in Parliament.
The country was jolted in the direction of approving same-sex marriage last weekend, when two major political parties said they would make the legislation a condition of any future coalition agreement with the Christian Democrats, who are not expected to win enough seats in September to govern alone.
Ms. Merkel reacted swiftly to the demand in an interview late Monday, calling for a vote in Parliament that “is a question of conscience, rather than something I push through with a majority vote.”
Gay rights groups described the outcome on Friday as a turning point.
“It’s very positive for the self-esteem of gays and lesbians; it’s very important for people coming out, knowing that they have this equality; and it sends a clear message to any homophobic refugees coming to Germany: We have equality here,” said Arnd Bächler, a counselor and addiction therapist at Berlin’s gay counseling center.
Approval of same-sex marriage in Germany could build momentum for similar legislation in other German-speaking countries, like Austria and Switzerland, said Katrin Hugendubel, advocacy director of ILGA-Europe, a gay and transgender rights group. She said the developments in Germany illustrated the difference that opposition parties could make.
“For us, the most important lesson is for the opposition to be very outspoken in supporting L.G.B.T.I. rights,” Ms. Hugendubel said. “The Social Democrats’ and the Greens’ making it a coalition condition raised the pressure on the conservatives, so it’s very important that those in favor across Europe make it a condition, and be very strong in their support.”
During the debate on Friday, some of the more conservative members of Ms. Merkel’s wing invoked the Constitution in defending marriage as a union between a man and a woman. It was not clear whether they would use this argument to challenge the measure before the Constitutional Court.
Volker Kauder, the leader of the conservative bloc in Parliament, including Ms. Merkel’s Christian Democrats and their Bavarian sister party, the Christian Social Union, warned the justice minister, Heiko Maas, that the law “cannot be changed out of political opportunism.” Mr. Maas, who suggested in 2015 that allowing same-sex marriage would require altering the Constitution, indicated the opposite this week.
“To me, it remains clear that same-sex partnership is not the same thing as a marriage,” Mr. Kauder said. “In our cultural circles, marriage has for centuries been a union between man and woman.”
Gerda Hasselfeldt, who leads the Christian Social Union in Parliament, argued that while all Germans deserved respect, conventional marriage was the foundation of family life and the “basis of order in our state.”
On the other side, Christine Lüders, the director of the German government’s anti-discrimination agency, said before the vote in Parliament that the new measure was “not about special rights for anyone, but about equal rights.”
Ms. Lüders said the law would play a significant role in combating discrimination, by helping make same-sex relationships a social norm in Germany, as they have become in many countries across Europe. Last week, the German Parliament voted to void the convictions of 50,000 men who were punished under a longstanding prohibition against sex between men that was repealed in 1994.
“I am certain that just a few years from now, as a society, we will look back on this decision on marriage equality and ask ourselves, ‘Why on earth did it take us so long?’” Ms. Lüders said.