Image:Olaf Scholz (right), interim leader of the SDP, spoke after treasurer Dietmar Nietan announced the result

He added: “We now have clarity, the SPD will enter the next federal government. The Social Democratic Party has not made this decision easy.”

On Twitter, Mrs Merkel wrote: “I look forward to working with the SPD again for the good of our country.”

The party had debated rejoining the grand coalition after suffering heavy losses in the September election.

But according to party treasurer Dieter Neitan, two-thirds of the 464,000 members who voted were in favour of the deal.

Parliament is expected to re-elect Mrs Merkel as Chancellor next week.

The SPD will put forward six names to lead the ministries they will control. It is understood they will be three men and three women.

Image:Mr Scholz said it was an ‘important democratic decision’ for Germany

Activists worked through the night to count the votes at the party’s headquarters in Berlin.

The SPD had initially ruled out another coalition, when they got just 20.5% of the vote in the September election, but the leadership campaigned for a yes vote to the new deal.

Mrs Merkel negotiated with other smaller parties, but one of those rejected a deal. German President Frank-Walter Steinmeier stepped in to urge the then leader of the SPD, Martin Schulz, to reconsider.

The members’ support for the deal dropped compared to 2013, when 76% voted in favour.