The move could spur other European countries where same-sex marriage is not recognized to follow suit.
Lawmakers voted 393 for same-sex marriage and 226 against it. There were four abstentions.
Merkel herself voted against the measure. “'For me, marriage is marriage between man and woman,” she said, according to German news agency dpa.
But she paved the way for the vote after saying on Monday that lawmakers could take up the issue as a “question of conscience,” freeing members of her Christian Democrats party to vote in favor.
The gay marriage bill, a last-minute addition in parliament's last session before the summer break, was backed by almost every party in the lower house.
Germany currently recognizes civil partnerships for same-sex couples, which guarantees most of the benefits as married heterosexual couples.
Merkel's Christian Democrats, and their Bavarian allies, the Christian Social Union (CSU), have long opposed to gay marriage: Their platform centers on "family values," and same-sex marriage was a red line for the party's conservative wing. Resistance persists despite Merkel's change of view.
Germany holds national elections in September, and legalizing same-sex marriage could benefit Merkel and those running for parliament. Two-thirds of Germans support marriage for all, according to a YouGov poll in May.