Two thirds of the membership backed the deal, a party official said - a wider margin than many had expected - ending more than five months of political uncertainty after an inconclusive election.

The result is set to hand long-serving chancellor Merkel a fourth term in office at a time when the European Union is looking to its largest country for leadership on a host of economic and security issues.

It clears the way for a re-run of the "grand coalition" that has governed Germany since 2013.

Acting SPD leader Olaf Scholz said at the party's Berlin headquarters: "The vast majority of SPD members followed the party leadership's suggestion."

"We now have clarity: the SPD will join the next German government," he added.

Scholz had said on Saturday turnout in the poll had been "very, very high" after an intense internal campaign that pitted the party's pro-coalition leadership against its more radical youth wing, which campaigned for "No".

The SPD initially planned to go into opposition after a disastrous result in September's election, but agreed to negotiate with Ms Merkel's conservatives after talks with the pro-business Free Democrats (FDP) and the environmentalist Greens on a three-way tie-up collapsed in November.

They thrashed out a coalition agreement which SPD leaders hailed for its commitments to strengthening the EU and giving them some key government roles