The marathon negotiation session, which went on for almost 24 hours, was the final round in six days of preliminary talks among Merkel of the center-right Christian Democrats; Horst Seehofer of their conservative Bavarian sister party, the Christian Social Union; and Martin Schulz of the center-left Social Democrats - the three parties that have governed Germany together in a "grand coalition" since late 2013.
The SPD has scheduled a special national conference on January 21 in Bonn, where party members will vote whether to join the formal grand coalition talks.
The agreement, reached after 24 hours of exploratory talks that stretched through the night, should pave the way for negotiations between the Bundestag's two biggest parties to resume the "grand coalition" that has governed the country for eight of the past 12 years.
After more than 24 hours of talks and months of political paralysis, red-eyed party chiefs and their negotiating teams reached an in-principle agreement to start formal coalition talks that could lead in coming months to a new government for the biggest European Union economy. The AfD surged into third place in September's election, the first time in decades that a far-right, openly nationalist party had won seats in Germany's federal parliament.
They agreed to limit the number of refugees entering the country to between 180,000 and 220,000 per year.
Considered a potential breakthrough on a new grand coalition following months of political uncertainty, the document could nevertheless be changed before the start of the formal talks.
Janes is optimistic that Merkel might be able to pull off a coalition not because of domestic issues, but because Germans are very "European-minded".
The hope was to form a new government "before Easter", which falls on April 1, said the CSU's Seehofer.
One primary reason for investors' cheer - which saw the euro jump to a three-year high of $1.2156 against the dollar - was simply relief that the country's political situation was being sorted out, nearly four months after the September 24 election.
Should the Social Democrats and Merkel's Christian Democratic Union and Bavarian-only Christian Social Union not be able to form a coalition, the only other paths ahead would be a Merkel-led minority government or fresh elections.
Janes said this could be looked at through a "bifocal lens" - a weaker Germany would mean there would be less of a European united front on, say, trade, in the E.U. They blame having been in a coalition with Merkel for the party's bad results in the September elections, and directly after the elections Schulz had ruled out a renewal.
"Who is going to fight for an exit from coal or a real reduction of Carbon dioxide emissions in the "grand coalition"?" asked Robert Habeck, who is running for the Green party's leadership.
But party leaders were in a buoyant mood on Friday morning. If that succeeds, then the parties will proceed to full-blown coalition talks.
If this grand coalition is formed, I think it will be favorable to Europe.
But another participant in the talks said the two blocs were still struggling to find common ground on the most divisive issues - taxes, pensions, migration and healthcare. But they are also decisions that can not be taken by a caretaker government.
The SPD want to improve the rights of workers and scrap Germany's dual healthcare system of premium private care and more widely accessible public care, replacing it with a single "citizen's insurance".