After months of political limbo, German Chancellor Angela Merkel's conservative alliance appears set to form a coalition government with its main rival, the Social Democratic Party (SPD).
Representatives from Merkel's Christian Democratic Union (CDU) party, alongside partners from the Bavarian Christian Social Union (CSU) party, agreed terms with SPD negotiators on Wednesday.
It follows an extended period of political uncertainty caused by the results of a federal election in September 2017, in which no party won a majority share of the vote.
Under the terms of Wednesday's agreement, Merkel will continue as chancellor for a fourth successive term, according to state broadcaster Deutsche Welle.
Merkel told reporters she had been forced to make compromises during the negotiations, but said the deal reached offers "the foundation of a good and stable government" with well-managed finances as its "signature".
SPD leader Martin Schulz will become foreign minister, Germany's DPA news agency reported.
Germany will change direction in Europe as a result of the deal, Schulz told reporters.
"With this coalition agreement, Germany will take an active and leading role in the European Union again," he said, adding that the government will be prepared to commit more funds into the EU budget.
Other SPD appointees are expected to fill the finance ministry post, as well as the labour and social affairs portfolio. Overall, the SPD is expected to get six ministerial positions.
The SPD has already been the junior partner in two Merkel-led "grand coalitions", from 2005 to 2009 and from 2013 to 2017.
Wednesday's agreement now requires the approval of the SPD's some 460,000 members.
Al Jazeera's Paul Brennan, reporting from Germany's capital, Berlin, said it is likely to be a close-run vote.
"In 2013, 76 percent of members voted in favour of approving going into a coalition with Merkel," he said.
"This time, sentiment seems very much more evenly divided, and there have been quite vociferous campaigns, particularly by the youth wing of the SPD, to say 'no, we are rejecting the status quo … we want to be an opposition party and shake things up'.
Pierre Moscovici, the European Union's economics commissioner, welcomed the deal, calling it "good news" for Europe on Twitter. Germany is Europe's largest economy.
Schulz had previously ruled out forming a coalition with Merkel's conservatives, saying that September's poll results - which saw the SPD recording its worst post-war election performance, at 20.5 percent - had "directed us to go into opposition."
Merkel's CDU/CSU alliance had finished first, securing 33 percent of the vote, down nine percentage points from 2013.
The biggest shock, however, was the emergence of the far-right Alternative for Germany (AfD) party as the country's third biggest political force, winning a 12.6 percent share of the vote.