Italy's populist Five Star Movement (M5S) and the center-left Democratic Party (PD) have put aside their traditional differences to form a new government and prevent new elections.
Five Star (M5S) said the coalition would be led by Prime Minister Giuseppe Conte, who had resigned following the collapse of the coalition government between M5S and the far-right Lega earlier this month.
"Today we told the president of the republic that there is a political agreement with the Democratic Party that Giuseppe Conte may be again given a mandate as prime minister," M5S leader Luigi Di Maio said.
PD leader Nicola Zingaretti said the two sides had decided to find common ground for the sake of the country's stability. "We love Italy and we consider it worthwhile to try this experience," Zingaretti told reporters following the talks.
Speaking shortly afterwards, Di Maio said: "We made commitments to the Italians...and come what may we want to fulfil them."
The M5S leader also said he had turned down an offer from the Lega, headed by Interior Minister Matteo Salvini, to become prime minister himself in return for renewing their alliance.
PD and M5S still need to agree a policy platform and a team of ministers.
Had the PD and M5S been unable to form a solid majority, the president would likely have called an early election for November.
Read more: Opinion: Salvini's lust for power puts Italy on the brink
Salvini, who triggered the crisis on August 8 when he withdrew his party from the governing coalition with M5S, said the new set-up was fragile and unlikely to last.
"So we have to wait six months or a year to win? We're in no hurry," he said.
Some political pundits have warned a M5S-PD deal could play into Salvini's hands in the long run, should the new accord come undone in the coming months.
In the meantime, Salvini has continued his controversial policy of preventing rescue ships carrying shipwrecked immigrants from docking in Italy. On Thursday he signed a decree banning a rescue ship carrying about 100 people picked up off the Libyan coast from entering Italian waters.
Read more: Debt and doom loops: The eurozone's Italian nightmare
bk/rc (AFP, Reuters)
Each evening at 1830 UTC, DW's editors send out a selection of the day's hard news and quality feature journalism. You can sign up to receive it directly here.