Italy resisted the entreaties and warnings of its European Union and American allies on Saturday by officially joining China’s vast new Silk Road at a signing ceremony with President Xi Jinping of China, a move that crystallized shifting geopolitical balances and the populist Italian government’s willingness to break with its traditional partners.

The agreement will “build a better relationship” between China and Italy, Prime Minister Giuseppe Conte of Italy said.

Italy became the first of the Group of 7 nations that once dominated the global economy to take part in China’s “One Belt One Road” project, which makes enormous infrastructure investments to move Chinese goods and resources throughout Asia, Africa and Europe.

The Trump administration, which tried and failed to stop the deal, focused in the days leading up to Mr. Xi’s visit on blocking any Italian use of 5G wireless networks developed by the Chinese electronics giant Huawei, which Washington warned could be used by Beijing to spy on communications networks.

Against the backdrop of Italian, Chinese and European flags, a host of Chinese and Italian ministers and business leaders signed 29 separate agreements at the Villa Madama, marking the culmination of Mr. Xi’s visit to Rome, where he was welcomed as a prized ally and, critics said, conqueror.

The memorandum of understanding formalized on Saturday provides a framework agreement for billions of euros in business deals between Italian and Chinese-state backed companies. But analysts said that what mattered more was its political symbolism, as it signaled waning American influence, a rising China and tensions among the founding partners of the European Union.

Interior Minister Matteo Salvini, Italy’s most powerful politician, was notably absent from the signing ceremony. In the weeks leading up to the agreement, he publicly assumed a more American-aligned and skeptical posture toward the deal, though he did not try to stop it. After the deal was done, he again ridiculed the notion that China was a “free market,” but said that as long as the deal served Italian interests, he was satisfied.

By contrast, his coalition partner, Luigi Di Maio, the leader of the anti-establishment Five Star Movement, championed the deal and made several visits to China in recent months. On Saturday, he beamed at the Villa Madama as he signed the first several agreements with Chinese counterparts, including those explicitly declaring Italy’s participation on new economic and maritime Silk Roads.

“Like someone in the United States said ‘America first,’” Mr. Di Maio said, “I continue to repeat ‘Italy first’ in commercial relations.”

The Chinese leader punctuated the signings by shaking the hand of Mr. Conte before flying off to the Sicilian capital, Palermo, a port city that hopes to benefit from Chinese investment, tourism and orange exports to China.

Mr. Xi, who was celebrated by the Italians with a state dinner and cavalry escort, is likely to get a less-festive greeting on Sunday when he visits Nice, France. President Emmanuel Macron, Chancellor Angela Merkel of Germany and representatives of the European Union will meet with him there and present a united front against what they consider China’s aggressive, and troubling, economic expansion into Europe.

This past week, as Mr. Xi met with Italian leaders, Mr. Macron announced an end to “the period of European naïveté” with regard to China and sought to strengthen rules protecting strategic economic sectors. They insisted on more reciprocity and transparency from China and sought to convince Mr. Conte that he was making a critical error by joining the One Belt One Road project.

Italy, which is saddled with crushing debt, hopes to lift its lagging economy by exporting goods to China and inviting more Chinese investment.

But opponents of the project in the Trump administration and in the European Union worry that Italy has turned itself into a Trojan Horse, allowing China’s economic — and potentially military and political — expansion to reach into the heart of Europe.

The Italians say their allies are exaggerating.

Michele Geraci, the chief Italian negotiator of the deal and an under secretary for economic development, said that Italy would avoid China’s debt traps and that its laws prevent foreigners from taking control of its ports, as China has done in Piraeus, Greece. He also argued that Italy’s European partners, who do billions of dollars more business every year with China, had already let them in.

“China uses the European Union as 28 Trojan doors,” he said, referring to the number of member states in the bloc. Italy, he said, had expanded its legal powers to defend against Chinese predatory acquisitions, especially in sectors of national security.

“We are the country in Europe and probably the world that would least fear a Trojan effect,” said Mr. Geraci, adding that because he had lived in China for a decade, “I know China very well, and we are more able than others to spot any risks.”

Even critics of the government argued that the agreement gave Italy a chance to catch up to Germany and France, which had much more business with China than Italy did.

“It’s a positive thing,” said former Prime Minister Romano Prodi, who attended the state dinner for Mr. Xi on Friday night. “It’s a competition between the countries of Europe.”

China also sees positive opportunities in Italy’s ports, which are connected to railways that run into the heart of Central Europe. But that is not new: The difference now is the willingness of the Italians to let them in.

Zeno D’Agostino, the president of Trieste’s port authority, who signed one of the agreements in Rome on Saturday, said it was only natural that Italians would be looking to China because the Trump administration had withdrawn from the world.

China, he said, “is opening because it feels strong,” and a port had to do business with those who engaged in the world.