Grassroots members of the populist Five Star Movement have voted to support the formation of a government with the centre-left, bringing to an end Italy's political crisis.
The two former adversaries have already reached a draft deal, after nationalist League leader Matteo Salvini pulled the plug on the previous administration.
The online vote of Five Star members means Italy now avoids fresh elections.
Independent law professor Giuseppe Conte will stay on as prime minister.
What was the vote for?
The two parties, Five Star and the centre-left Democratic Party (PD), have agreed a 26-point draft programme to rule Italy. However, the anti-establishment Five Star party required the backing of some 100,000 members before signing up to the coalition.
Using a controversial, online platform called Rousseau, 79,634 members logged on - a record number - on Tuesday and 79.3% voted to back a coalition with the PD, run by Mr Conte.
The Rousseau platform, used since 2016, has been widely criticised after it was attacked by hackers and failed to protect its users' data. However, the man responsible for the system, Davide Casaleggio, hailed the process as a "world record in online participation in a political vote".
Five Star leader Luigi Di Maio said that in under a month a government crisis had been resolved and his party had guaranteed stability in Italy by means of "a new, transparent method that allowed citizens to take part".
Now that the Five Star membership has given the coalition its approval, Mr Conte is set to present the government's programme to President Sergio Mattarella as early as Wednesday.
Last month, Mr Conte launched a blistering attack on Mr Salvini, pre-empting a vote of no confidence in his leadership by announcing his resignation. He has since served as caretaker prime minister.
What is in the agreement?
Details of the new coalition's 26-point draft programme began to circulate on Tuesday until they were produced in full by Five Star, whose leader said all of the party's 20 pledges had been included.
Key for both parties is a commitment to pass a budget within weeks to block a rise in VAT (sales tax), which is set to kick in automatically on 1 January if the government fails to reach its debt-reduction target.
Significantly, one of Five Star's key ambitions, to cut the number of MPs and senators in Italy's parliament, is also part of the deal.
There will also be a loosening of Mr Salvini's decision to close Italian ports to charity-run boats carrying migrants rescued from the Mediterranean. Instead, the parties talk of a "strong European response" to the issue of migration.
The parties aim to introduce a minimum wage and a "Green New Deal", as well as to cut taxes and increase spending on education, welfare and research. A public bank will be set up to boost development in Italy's poorer south.
Key ministry jobs have not been announced, but Mr Di Maio is set to lose his status as deputy prime minister.
Some reports suggested he could become foreign minister with the interior ministry role, previously held by Mr Salvini, going to the PD. Centre-left leader Nicola Zingaretti is unlikely to have a prominent role. The lead PD figure is expected to be Dario Franceschini, a former culture minister.
The markets welcomed the news of Italy's nascent government, with 10-year bond yields falling to record lows.