The parties said they were making an "optimistic start" on talks after months without a stable government in Germany.

Angela Merkel
Image: Leaders on both sides say they are 'optimistic' about reaching a deal

Angela Merkel's Christian Democrats (CDU) and the Social Democrats (SPD) have agreed to talks on a possible new government.

Both parties have said they are hopeful about the exploratory talks due to begin on 7 January, which would pave the way for full-blown negotiations about a coalition.

The German Chancellor's Bavarian allies, the Christian Social Union, will also be participating in the discussions.

"Confidence has risen and we are making an optimistic start," the parties said in a joint statement following a meeting on Wednesday.

All three parties - the CDU, SDP and CSU - formed part of the "grand coalition" that has ruled Germany since 2013.

But Europe's largest economy has been without a stable government and in a state of political limbo since September, when an election produced no overall majority - with all three parties losing seats.

This has been the longest period that Germany has failed to form a new government after an election since 1949.

Mrs Merkel from 1991 to 2013
Video: The many faces of Angela Merkel

In November, Mrs Merkel's talks with the Greens and the pro-business Free Democrats (FDP) collapsed after four weeks of negotiations - raising doubt about her future following 12 years in power.

She is now leading an interim government with the SPD, but the alliance has been plagued by disagreements with the centre-left party.

Some conservatives have called for tax cuts for high earners and reductions in benefits for asylum seekers, which are opposed by the SDP.

SDP leader Martin Schultz said he had entered into "concentrated, focused consultations" with the other leaders, which he regarded as a good basis for formal talks.

Talks are due to start on Sunday, and could lead to official coalition negotiations within weeks. If successful in bridging divides between the two parties, they would mean a fourth term in office for Ms Merkel.

More world news