BERLIN — When Sarah Kermer proposed to her girlfriend in March, she knew she was in love, but she did not know when, if ever, Germany would allow them to marry.

The answer came early Friday morning, when the lower house of the German Parliament voted to legalize same-sex marriage after a brisk but emotional debate, prompting Ms. Kermer and scores of other gay and lesbian Germans to celebrate in the streets.

“I was at work, and I just started crying,” Ms. Kermer, 25, said as she and her fiancée left a spontaneous gathering at the Brandenburg Gate in Berlin. “I was watching the decision on live-stream, and I cried — a lot. This has all happened just so fast.”

The historic decision came with a swiftness rare in Germany’s usually staid politics, just five days after Chancellor Angela Merkel unexpectedly relaxed her party’s opposition to same-sex marriage and allowed lawmakers to vote on the issue according to their consciences.