By now, the “grand coalition,” as the tie-up is known, looks anything but grand: In polls, it no longer commands a majority. And the far-right Alternative for Germany party, AfD, now the official main opposition in Parliament, has been gaining momentum.
“This episode will mark German politics for a long time,” said Henrik Enderlein, a professor of political economy at the Hertie School of Governance in Berlin. “The two large parties will have to fight hard to win back control.”
So unpopular was the prospect of another stint in government with Ms. Merkel that the Social Democrats had promised their 463,000 members a vote on the coalition treaty, effectively making them the arbiters of whether their nation of 82 million people would finally have a government. Some 78 percent of party members voted, of which more than 66 percent supported the new government.
“The members of the Social Democrats did not take this vote lightly,” said Olaf Scholz, the party’s acting leader, after Dietmar Nietan, treasurer of the Social Democrats, announced the decision.
The vote came four months after Ms. Merkel failed in her first attempt to build a coalition. It also came after Martin Schulz was forced to hand over the reins as leader of the Social Democratic Party.
The result means a new German government could be sworn in as early as March 14. The new administration, however, will lack the strength of its predecessor, formed after a similar nail-biting vote by the Social Democrats in 2013.
Ms. Merkel has noted that she needs to focus more on domestic issues as the country grapples with the challenges of integrating the roughly one million migrants who arrived in Germany in recent years.
In the prelude to the vote, Social Democratic leaders crisscrossed the country, holding a series of town-hall-style meetings in a bid to persuade members to either support or reject a new coalition government with the Christian Democrats.
Governing with their traditional rivals has blurred the lines between the two camps. When the Social Democrats first joined Ms. Merkel’s conservatives in government, in 2005, they received 34 percent of the vote. After the S.P.D.’s second stint as a junior coalition partner, over the past four years, that share fell to 20 percent.
Both the Social Democrats and the Christian Democratic Union have lost ground to the political extremes in recent years. The arrival of the anti-immigration AfD party in the national Parliament after the September vote has made forming a government much harder.
Parliament now includes lawmakers from seven political parties, spanning the full political spectrum, and traditional postwar coalitions on the left or right no longer have a majority. With the S.P.D.’s decision to enter the government, the AfD will now become the strongest opposition force in Parliament, a largely symbolic but important position that is viewed as providing a check on those in power.
The past weeks have seen the S.P.D.’s popularity plunge even further, with the party losing as much as another five percentage points in some surveys and dropping behind the AfD in popularity in the eastern states. In addition, infighting over leadership and ministerial posts further frustrated supporters.
S.P.D. leaders were quick on Sunday to highlight the need to reach out to the one-third of members who voted against the coalition, while also regaining the trust of lost voters.
“Above all, we must reach out to those who believe the voices telling them that ‘You have been left behind,’ and show them that we are there for them,” said Dietmar Woidke, the Social Democratic governor of the eastern state of Brandenburg.
There has been much talk about the lack of a minister from eastern Germany among the cabinet nominees from Ms. Merkel’s conservative party, which bled support to the far-right. Although the Social Democrats have not yet named their candidates for ministerial positions, Mr. Woidke emphasized the importance of including someone from the east, while conceding that one minister alone would not suffice to solve the party’s problem of weakening support in the country’s eastern states.
“It would be largely symbolic,” Mr. Woidke said. “But politics is all about symbolism.”
In the September election, Ms. Merkel’s party had its worst showing since the Federal Republic of Germany was founded, in 1949. An attempt late last year to form a coalition government, with the free-market Free Democrats and the Greens, failed after four weeks of discussions.
The Christian Democrats took up new negotiations with the Social Democrats, and a coalition agreement emerged in early February. The 179-page document details the main issues to be addressed, such as spending and which party will name ministers to take cabinet posts in the government.
The Social Democrats walked away with three key portfolios — the foreign, labor and finance ministries — which will play a crucial role in coming negotiations over the issue of overhauling the euro currency union.
Those ministries could also offer the Social Democrats a chance to regroup and define their positions in the coming years, after which they would face an election without Ms. Merkel, who has said this term in office will be her last.
Berlin’s neighbors, in the meantime, have been waiting for it to return its focus to the world. President Emmanuel Macron of France needs Ms. Merkel’s support if he is to help push through ambitious overhauls to protect the euro area against another financial crisis.
Britain wants the chancellor’s attention on talks about the country’s negotiations to leave the European Union, a process known as Brexit. And across Europe, countries rely on German leadership on issues as far-ranging as migration and defense.