“Our political message is very clear,” said Valdis Dombrovskis, vice president of the European Commission, the bloc’s executive arm. “Italy needs to continue to reduce its public debt, which is indeed second highest in the E.U. after Greece.”

Mr. Conte’s debut on the national stage on Monday was not entirely smooth. Apparent exaggerations in his résumé, first reported by The New York Times, set off a deeply politicized debate about whether he should serve as prime minister.

But the populist leaders stuck with him, saying the alternative to Mr. Conte was new elections.

As Mr. Conte met with the president, Mr. Salvini told reporters on the street that the incoming prime minister would have “full” autonomy. He also said that for Mr. Conte, like for him, “the well being of Italian citizens” came before European considerations.

Five Star leaders applied pressure to the president to give them a chance at the helm, warning Mr. Mattarella against blocking the will of the people.

The 11th-hour deal between the two parties came last week after weeks of intense, and sometimes secretive, meetings between Mr. Di Maio and Mr. Salvini after the president threatened to impose a technocratic caretaker government.

The party leaders’ ambitions to become prime minister seemed the biggest obstacle. But once that was set aside in favor of backing Mr. Conte, their alliance made electoral sense. The parties together won half of the Italian vote in March: Five Star received a third of the vote, and the League won 17 percent.

The most hostile attacks often took place on social media, where both parties and their leaders are fluent, but where the Five Star Movement is a pioneer that has made Italy a laboratory for experiments with web-based democracy and viral messaging. Brussels was a frequent target.