Germany's Social Democrats (SPD) decisively backed another coalition with Chancellor Angela Merkel's conservatives on Sunday, clearing the way for a new government in Europe's largest economy after months of political uncertainty.
Two thirds of the membership voted "yes" to the deal in a ballot -- a wider margin than many had expected -- meaning Merkel could be sworn in for a fourth term as early as the middle of the month in a repeat of the grand coalition that has governed since 2013.
"I think it's good for our country that this period of uncertainty is over," German President Frank-Walter Steinmeier said, adding that he would on Monday propose Merkel's election as chancellor to the lower house of parliament.
The president's role in Germany is largely ceremonial, with the real power residing with Merkel.
The challenges are piling up for the 63-year-old Merkel, who has been acting chancellor for more than five months since an inconclusive election, with the European Union looking for leadership on economic and security issues and France seeking a partner for President Emmanuel Macron's ambitious EU reform plans.
Macron hailed the development as "good news for Europe.”
A statement from his office added: "France and Germany will work together on new initiatives in the coming weeks to bring the European project forward."
Acting SPD leader Olaf Scholz announced the result to activists lining the balconies around the atrium of the party's Berlin headquarters early on Sunday.
"We now have clarity: the SPD will join the next German government," Scholz said.
The party had initially planned to go into opposition after its worst election result since Germany became a federal republic in 1949.
Merkel, in power since 2005, took to her party's Twitter feed to congratulate the SPD. "I look forward to working with the SPD again for the good of our country," she said.
The SPD ballot pitted the leadership of the centre-left party against the radical youth wing, which wanted the SPD to rebuild in opposition after a disastrous election showing.
"I'm happy it worked out this way," Andrea Nahles, the SPD's likely next leader, told Reuters.
Scholz declined to comment on reports that he would be finance minister, saying only that the SPD would appoint three men and three women to the federal cabinet. As part of the price for its support, the SPD will take the helm at key ministries, including the finance ministry.
The outcome means the far-right Alternative for Germany (AfD) will be the largest parliamentary opposition party. In a tweet, they labelled the SPD's decision a catastrophe for Germany, promising fierce opposition to the government.
Kevin Kuehnert, head of the SPD's youth wing, said he was disappointed but that the "Jusos" (youth wing) would keep up their criticism, signalling that, after bringing in a flood of new members, they would be a thorn in the leadership's side.
"Criticism of the grand coalition remains. The SPD needs to be more like it has been in recent weeks and less like it has been in recent years - the Jusos will ensure this," he tweeted.
The party, already one of Europe's largest, has seen tens of thousands of new members join this year. Turn-out in the poll was over 78%.
German business greeted with relief the news that Germany would get a government after its longest-ever post-election interregnum.
"While the United States are starting a trade war and China is challenge our industrial leadership, we have been unnecessarily self-absorbed," engineering trade union VDMA's managing director Thilo Brodtmann said.
The SPD was forced to revisit its original plan to go into opposition after the failure of Merkel's initial attempt to form a coalition with two smaller parties.
With her conservatives, they thrashed out a coalition agreement which SPD leaders hailed for its commitments to strengthening the EU and giving them key government roles.