German Chancellor Angela Merkel's conservatives and the Social Democrats have agreed to a coalition deal, taking Europe's economic powerhouse closer to a new government after months of uncertainty that unnerved allies and investors.

In a move likely to mean a shift in Germany's eurozone policy, media reported the Social Democrats (SPD) would take the finance ministry.

The post was previously held until recently by conservative Wolfgang Schaeuble, widely despised in struggling eurozone states during his eight-year tenure for his rigid focus on fiscal discipline.

SPD leader Martin Schulz said earlier this week that his party had ensured an agreement with the conservatives would put an end to "forced austerity" and set up an investment budget for the eurozone.

Handing over the crucial finance ministry suggests the conservatives had to make big concessions to get the SPD to agree to renew the 'grand coalition' that has governed Germany since 2013 and secure Ms Merkel's fourth term in office.

Bruised by its worst election result in the post-war era, the SPD had planned to revamp itself in opposition and only agreed to the coalition talks reluctantly.

Its 464,000 members still have the chance to veto the deal in a postal ballot.

While the talks have dragged on, Europe's biggest economy has moved into overdrive, suggesting that there may be increased scope for government spending and investment.

In a message posted alongside a photo of Mr Schulz and other SPD negotiators smiling, the SPD negotiators wrote: "Tired but happy. There is a treaty! Finally. Now the final details are being worked into the text."

The agreement should allow Germany to resume its leading role in international affairs and, at least for now, put an end to questions about how long Ms Merkel will stay in her job.

Meanwhile, Martin Schulz announced today that he is to step down as leader of the Social Democrats. 

He said he intends to serve as foreign minister in the new coalition government.

Mr Schulz indicated that the party's parliamentary group leader, Andrea Nahles should replace him as leader of the SPD.