Their pick for Prime Minister, Giuseppe Conte, abandoned his mandate to form a government on Sunday after Mattarella refused to allow Paolo Savona, an outspoken critic of the European Union, to take up the post of minister of economy.
Conte, a university law professor who was still teaching class Thursday, has as deputy premiers his two political masters: Di Maio and Salvini.
The anti-establishment 5-Star Movement and right-wing League are to swear in their Cabinet later Friday, capping a rollercoaster week of political and financial turmoil by reaching agreement with Italy's president to drop a euroskeptic economy minister.
Italy has been without a government for almost three months after the March elections came out inconclusive.
Conte's government faces mandatory confidence votes next week in parliament, where the two governing parties have a slim majority.
Could tensions arise between the Five Star Movement and the Lega following the formation of a government?
"The good times for illegals is over - get ready to pack your bags", Salvini said at a rally in Italy's north on Saturday, adding however that he wants to economically assist migrants' countries of origin.
Mattarella then asked pro-austerity economist Carlo Cottarelli to form a caretaker government.
The Cottarelli government, which would see Italy through a period of uncertainty, seems doomed before it is created.
In a surprise twist to Italy's drawn-out political saga, Five Star and the League frantically re-engaged in talks to get their coalition back on track Thursday, and emerged triumphant.
The populist Five Star Movement and the right-wing Northern League had agreed to form a government based on their common anti-establishment stance, in spite of major political differences.
The uncertainty rose after President Sergio Mattarella's designation of Mr Cottarelli, a former International Monetary Fund official, to head a politically neutral government failed to calm markets.
Mattarella's office said it was studying Di Maio's proposal "with attention".
The program proposed by the populists promises to revive Italy's sluggish economy by rejecting austerity and increasing spending.
Wednesday's development came as financial markets calmed after a rout a day earlier, when investor concerns about Italy's finances prompted the biggest one-day rise since 1992 in Italian two-year bond yields and dented the euro's exchange rate.
Italy's 2.3 trillion euros of debt is 132 percent of its gross domestic product (GDP), the highest ratio in Europe apart from Greece and more than double the bloc's 60-percent ceiling.
The eurosceptic coalition also promises a series of measures to reign in the European Union including renegotiation of European Union treaties and a review of the bloc's economic governance on issues such as the single currency.
European Commission President Jean-Claude Juncker told a conference Thursday that he loved Italy, but refused to accept the frequent pass-the-blame mantra by Italian politicians that Italy's ills are the fault of the EU.
"Employers and employees in Italy must not be enemies", he said, promising "I will not disappoint you". "But don't play this game".
Italy's famed aeronautic acrobatic squad has flown low and loud over downtown Rome trailing smoke in the red, white and green of the Italian flag as President Sergio Mattarella placed a wreath at the tomb of the unknown soldier.
Salvini said he would set straight to work on a campaign pledge to expel many of several hundred thousand asylum-seekers who were rescued at sea from human traffickers over the last few years but are ineligible for asylum.
Syria's Assad says Damascus almost won 7-year-war
Also Thursday, Israeli Defense Minister Avigdor Lieberman visited Moscow for talks focusing on Syria. He said it was down to "the wisdom of the Russian leadership" that a confrontation did not happen.
Eurozone inflation in big jump just as uncertainties mount
The pan-European Stoxx 600 closed provisionally up nearly 1 percent, with most sectors and major bourses in positive territory. Spain's IBEX 35 jumped 1.8 percent after Spanish Prime Minister Mariano Rajoy was ousted as leader of the country Friday.
'I wish' I didn't pick Jeff Sessions as attorney general
Concerning Sessions, Trump has expressed similar sentiments before, but the attorney general hasn't taken the hint to step down. Trump has publicly criticized the attorney general over his recusal, calling it a "terrible mistake for the country" in April.
Ten tips that help to win
Tip # 2 You need to find out as much information as you can on the online casino before you will give away your money. Unlikely you will want to swim in the dark pond if you have no idea what is waiting for you below the surface.