
Merkel, who will seek a fourth term in a national election on September 24, told reporters after the landmark decision that she had voted against the measure because she believed that marriage as defined under German law was between a man and a woman.
However, she said her decision was a personal one and added that she had become convinced in recent years same-sex couples should be allowed to adopt children.
"I hope that the vote today not only promotes respect between the different opinions but also brings more social cohesion and peace," Merkel said.
The parliament voted by 393 votes in favour of same-sex marriage to 226 against.
Many other European countries, including France, Britain and Spain, have already legalised same-sex marriage.
Merkel's announcement on Monday that she would allow lawmakers to vote on same-sex marriage according to their individual conscience drew the ire of some in her traditionally Catholic conservative bloc.
But political analysts say the issue will likely have faded from voters' minds by the time the September election comes around.
Friday's vote marked a rare victory for Merkel's Social Democrat (SPD) coalition partners, who were trailing the conservatives in opinion polls.
They had seized on Merkel's surprise comments on Monday to say they would push for an early vote before parliament's summer recess.
Success in passing the so-called "marriage for all" amendment could provide a sorely needed boost for the centre-left SPD, which has seen a short-lived boost in the polls earlier this year evaporate in recent months.
The measure will likely be signed into law by the president some time after July 7.
FINES ON HATE SPEECH
Parliament also approved a plan to fine social networks up to €50 million ($NZ77 million) if they failed to remove hate speech and fake news quickly, despite concerns the law could limit free expression.
Germany has some of the world's toughest laws covering defamation, public incitement to commit crimes and threats of violence, with prison sentences for Holocaust denial or inciting hatred against minorities. However, few online cases are prosecuted.
The measure requires social media platforms to remove obviously illegal hate speech and other postings within 24 hours after receiving a notification or complaint, and to block other offensive content within seven days.