The deal followed an extraordinary few days in which Mr Di Maio called for the head of state to be impeached, two successive prime ministers-designate were tasked to form a government, one of whom quit only to be reinstated on Thursday evening.
"We will work hard to reach the objectives included in the government contract and to improve the quality of life of all Italians", Conte said.
Both party leaders expressed fury at Europe's political and economic elite after their choice of a staunchly Eurosceptic finance minister was vetoed by Mr Mattarella in favour of Carlo Cottarelli (64), a former International Monetary Fund economist.
Europe's euroskeptic politicians cheered and Milan's stock index rose Friday after Italy's populists put an end to three months of political gridlock, staving off the threat of new elections and forming Western Europe's first populist government.
A day after the possibility of a governing coalition between the anti-establishment 5-Star Movement and the right-wing League was revived, League leader Matteo Salvini canceled appointments in northern Italy to travel to Rome.
The first, Visco says, would be applying an anti-austerity programme negotiated by Five Star and the League, "which he knows to be completely inapplicable" given Italy's 2.3 trillion euro public debt.
Economist Paolo Savona - whose nomination by M5S and League in their previous government attempt triggered the confrontation with the president, and the failure of their bid - will now serve as Minister of European Affairs, according to Conte.More news: Avenatti alleges Michael Cohen recorded 'inappropriate' conversations
More news: LeBron James did not like reporters' question, leaves presser with a message
More news: Wall Street falls on Italy political crisis
After reaching the agreement, Mr Salvini and Mr Di Maio said in a joint statement: "The conditions for a political government have been found".
President Sergio Mattarella on Thursday approved a cabinet list presented by Giuseppe Conte.
Di Maio, whose 5-Star emerged from the inconclusive March 4 elections as the largest single party, urged Salvini to drop his insistence on Savona for the economy portfolio and agree to give him another post in the next government.
Their fury was backed by populists across Europe who were incensed that Mr Mattarella had apparently bowed to pressure from the financial markets and leading French, German and European Commission figures warning against Italy breaking EU budget rules.
Mr Tria has been critical of the EU's economic governance, but unlike Mr Savona he has not advocated a contingency plan for exiting the euro. In the past, both parties have called for a referendum to determine if Italy should stay in the Eurozone.
Mr Di Maio, whose party is the biggest in Italy's parliament, will be a deputy prime minister in charge of welfare. The firm has had an underweight position on Italy's debt, he added, as political and market uncertainties persist.
"There's no reference (in his CV) to masters or other university titles, but the simple and accurate description of his work as a scholar and university professor", the movement said in a post on its official blog.