US President Joe Biden hailed closer ties with Vietnam on Sunday as the two countries struck a deal to deepen cooperation, including on semiconductors, but said he was not aiming to contain China.
The "comprehensive strategic partnership" with Hanoi is part of Washington's push to bolster its network of allies around Asia and the Pacific in the face of Beijing's rising influence.
Biden accused Beijing of seeking to bend the international order to its will.
"One of the things that is going on now is China is beginning to change some of the rules of the game, in terms of trade and other issues," Biden said.
Sometimes to Beijing's chagrin, Washington has invested heavily in building alliances as part of its Indo-Pacific strategy, including the Quad security dialogue with India, Australia and Japan, and the AUKUS pact with Britain and Australia.
Biden said he wanted establish clear ground rules for relations.
"I don't want to contain China. I just want to make sure we have a relationship with China that is on the up and up, squared away, everybody knows what it's all about," he said.
Biden flew in to Hanoi straight from a G20 summit that failed to agree to a phase-out of fossil fuels and highlighted deep divisions over the Russian invasion of Ukraine.
The US president said he had met Chinese Premier Li Qiang at the G20 -- a meeting the White House had not announced -- and discussed "stability".
- Semiconductor deal -
Global supply chain shocks and fears about US reliance on China for strategic resources have further driven the push to boost ties with the likes of Vietnam.
The new partnership includes an agreement on semiconductors, with the United States committing to help Vietnam develop its capabilities and expand production.
There is also a section on rare earth minerals, which used in the manufacture of high-tech devices such as smartphones and electric car batteries.
Vietnam has the world's second-largest deposits of rare earths after China and US officials say it has a key role to play as it looks to diversify and strengthen its supply chains.
Biden moved last month to restrict US investment in Chinese technology in sensitive areas including semiconductors, quantum computing and artificial intelligence.
"This can be the beginning of even a greater era of cooperation," Biden said as he met Nguyen Phu Trong, the head of Vietnam's ruling Communist Party and the country's paramount leader.
"Vietnam and the United States are critical partners at what I would argue is a very critical time."
The deal puts the United States on a par with China -- as well as Russia, India and South Korea -- at the top level of the Vietnamese hierarchy of diplomatic relations.
Trong thanked Biden for his contribution to improving US-Vietnamese ties and said his country would work hard to implement the new agreement.
Although it is careful to be seen as not taking sides between the United States and China, Vietnam shares US concerns about its neighbour's growing assertiveness in the contested South China Sea.
However, The New York Times reported just ahead of Biden's visit that Vietnam was secretly arranging to buy arms from Russia in contravention of US sanctions.
The report cited a Vietnamese finance ministry document that laid out plans to fund arms purchases from the Kremlin through a joint oil and gas project in Siberia.
AFP has contacted the Vietnamese government for comment.
US Deputy National Security Advisor Jon Finer told reporters that Washington acknowledged Vietnam's decades-long military relationship with Russia.
But he said there was "increasing discomfort on the part of the Vietnamese with that relationship", and the new partnership would help Hanoi "diversify away from those partnerships" by allowing it to source from the United States and its allies.
- Human rights -
Biden said he had raised human rights in his meeting with Trong and pledged to "continue our candid dialogue in that regard".
Vietnam has a dire rights record. Government critics face intimidation, harassment and imprisonment after unfair trials, and there are reports of police torture to extract confessions, Human Rights Watch says.
While Biden has often criticised China's human rights record, he has largely stayed quiet on Vietnam and campaigners feared he may not raise the subject.
On Monday Biden visit a Hanoi memorial to his friend John McCain, the former US senator shot down and held captive during the Vietnam War who in later years helped rebuild ties between the two countries.