Merkel's Christian Democrats (CDU) and their Bavarian sister party, the Christian Social Union (CSU), won the September 22 election but fell short of a majority. They needed a partner and spent much of the last three months negotiating a coalition deal with the arch rival SPD, which came a distant second.
A "no" vote could have plunged Germany into crisis and complicated European Union efforts for a banking union reform that would see the European Central bank police the sector with a new agency to shut down weak lenders.
Such a scenario would have also forced Social Democrats (SPD) leader Sigmar Gabriel and his deputies to resign. Despite losing the election, they lobbied hard to win over sceptical members after getting much of their campaign programme incorporated into the coalition agreement.
The SPD said 76% of its grassroots members who took part in the unprecedented postal ballot voted to join forces with the conservatives despite initial misgivings. The SPD said 256,643 voted "yes" while 80,921 voted "no". Some 32,000 ballots were invalid.
"We're not only the oldest party in Germany but we're also the most modern party - the party of mass participation," Gabriel told some 400 cheering SPD volunteers who had spent the day counting some 369,680 ballots in a cold Berlin warehouse.
"We've set new standards," added Gabriel, who managed to turn September's electoral defeat into a rallying point for the SPD with the referendum gamble. "We don't just talk about grassroots democracy. We live it. I haven't been as proud of my party in a long time."
A leftist agenda
However, the SPD, still struggling to overcome the steep drop in support from the 2005-09 "grand coalition" under Merkel, could prove to be less pliant junior partners this time around.
Thanks to what analysts called a clever strategic move to ask grassroots members to vote on the coalition, the SPD forced Merkel to accept many of the SPD's leftist policies even though the conservatives scored 41.5% of the vote in September compared to 25.7 for the SPD.
Conservative leaders had already approved the deal and Merkel's deputy in the CDU, Hermann Groehe, said the conservatives were "delighted" by the results of the vote.
"We're pleased that the new government can get to work," he said.
The new cabinet
With Merkel as chancellor and Wolfgang Schaeuble as finance minister, Germany's most high-profile representatives on the European stage will be unchanged and the new coalition promises continuity in EU policy.
The biggest surprise came with the announcement that Ursula von der Leyen would become Germany's first female defense minister. The politician from Lower Saxony had headed the ministry of family affairs and the labor ministry in Merkel's first and second terms, respectively.
Angela Merkel has ceded control of Germany's controversial shift from nuclear to renewable energy to her Social Democrat(SPD) rivals, who will take charge of ministries responsible for the environment and energy.
SPD Chairman Sigmar Gabriel himself is to head a new 'super' ministry which combines economy and energy and will help oversee Germany's transition to renewable energy sources.
One of SPD top priorities will be a reform of the complex renewable energy law, which has sent costs for consumers soaring because of generous incentives for solar and wind power.
The "grand coalition" government of Merkel's conservatives and the SPD has pledged to agree the reform by Easter.
SPD treasurer Barbara Hendricks would replace Peter Altmaier, of Merkel's Christian Democrats (CDU), as environment minister.
The surprise move gives Merkel's rivals control of the biggest domestic policy initiative of her second term, yet may also deflect any future blame from the chancellor, should the energy shift falter or prove deeply unpopular.
SPD's Frank-Walter Steinmeier would return as foreign minister, a post he held between 2005 and 2009. SPD General Secretary Andrea Nahles would take the post of labour minister and the SPD's Heiko Maas that of Justice Minister.
Germany's nuclear exit was accelerated by Merkel after the Fukushima nuclear disaster in Japan in 2011. The last reactor is due to be taken off the grid by 2022.
The new government faces a delicate balancing act, reducing the incentives to help industry, while ensuring investment in renewables does not grind to a halt.
Subsidies for renewable energy are largely paid for by households, whose bills have almost doubled over the past decade and are now the second-highest in Europe. Heavy electricity users such as cement, steel and chemical plants are exempt from the surcharge to keep them from being priced out of global markets.
The renewables law has got Germany into hot water with Brussels however, on suspicion it infringes competition laws.
The European Commission is to open an investigation into the law, according to a draft letter sent by EU Competition Commissioner Joaquin Almunia to the German government and seen by Reuters.
The Commission can ask a government to recover aid granted to companies if this is found to have breached EU rules.