Germany is set to emerge from months of political deadlock after Angela Merkel's conservatives (CDU/CSU) finally agreed a coalition deal with the centre-left Social Democrats (SPD).
Negotiators have agreed on the division of key ministries - one of the last hurdles towards forming a government.
It could end more than four months of wrangling since inconclusive elections in September.
But the deal will still need to be approved by SPD members.
Many in the party fear that re-entering a coalition with CDU/CSU could damage it in the long term.
In a joint news conference on Wednesday, Chancellor Merkel said the agreement gave the basis for a "good and stable government".
SPD leader Martin Schulz thanked the conservatives for making what he said were tough compromises.
In a tweet, he said the deal "achieved a lot for people" and he would be recommending that his party members accept it.
What has been agreed?
The SPD looks set to control six ministries, including finance and foreign affairs.
Mr Schulz has confirmed he will step down as SPD leader in March and instead become foreign minister, if the coalition deal is approved by SPD members.
He will be replaced as SPD leader by former Labour and Social Affairs Minister Andrea Nahles.
The SPD's 460,000 members will have the final say on the whole agreement in a postal vote, the result of which will be announced on 2 March.
Those opposed to any deal with Mrs Merkel include a new group within the SPD calling itself NoGroKo (no grand coalition).
Why does Germany's government matter?
By Damien McGuinness, BBC News, Berlin
Handing Germany's centre-left control of finance, foreign and labour policy would have a big impact on the rest of the world, particularly Europe.
The promised spending spree on infrastructure and services will likely boost Germany's economy further, and the tax cuts may give an added boost to German consumer spending.
A Social Democrat finance ministry - replacing pro-austerity Wolfgang Schäuble - is more likely to go along with French President Macron's ambitious plans for EU reform, by allowing more German support for struggling eurozone economies.
Mr Macron wants to create a common eurozone budget and a eurozone finance minister, but Germany has so far been wary of any move that might lead to what it calls a "transfer union" used to prop up indebted governments.
An SPD-led finance ministry could be much more amenable to Mr Macron's proposals.
And at home these powerful ministries would help the SPD push for key left-wing policies, such as better rights for employees.
All of this could go down well with SPD party members, who will vote on any final coalition deal.
An agreement which looks like a win for the SPD will increase the likelihood that they will vote yes.
But if they vote no, then the most likely outcome could be fresh elections.
Why has this taken so long?
Mr Schulz at first ruled out going back into government with Mrs Merkel's centre-right CDU and its Bavarian sister party, the CSU.
The parties had seen their popularity drop after being in coalition on and off since 2005.
He changed his mind when CDU/CSU coalition talks with the liberal Free Democrats (FDP) and Greens broke down.
Both Mr Schulz and Mrs Merkel have been under pressure to see off a challenge by the far-right Alternative for Germany (AfD), which became the third biggest party in September's election.
Other than distributing ministries, there have been big stumbling blocks in the coalition talks over workers' rights and healthcare.
Immigration, Europe, and tax, have also been points of contention.
What has the reaction been?
European Union allies, such as France, see Germany as a pillar of stability in the bloc and have been hoping Mrs Merkel succeeds.
Top EU officials, including the Economics Commissioner Pierre Moscovici, welcomed the breakthrough on Wednesday.
But inside Germany, FDP leader Christian Lindner said the CDU had been "willing to give the SPD everything - key ministries and top positions - to keep the chancellorship".
He said in a tweet: "Relaunching the German model in this parliament with this arrangement and this chancellor will clearly not be possible."
Meanwhile Alice Weidel, the head of the far-right AfD's group of MPs in the new parliament, criticised the coalition's proposed immigration policy, which would see up to 220,000 asylum seekers given residency each year and a scheme to encourage highly-qualified people to move to Germany.
She told Die Welt newspaper: "The chasm between the ruling parties and the people of our country has never been bigger."