Japan pledged new patrol boats and $1.1 billion in aid to Vietnam Monday as part of a sprawling package targeting maritime and security affairs to bolster ties in the face of regional powerhouse China.
Hanoi and Tokyo are locked in separate standoffs with Beijing over territorial claims in disputed regional waters, pushing the two countries closer in recent years.
Japanese Prime Minister Shinzo Abe announced the six new vessels and the 130 billion yen loan package during a two-day visit to Vietnam, which is also aimed at boosting business ties with the fast-growing communist nation.
"I wish to make basic principles such as freedom of navigation, rule of law and peaceful resolution of conflict to become unshakable," Abe told reporters.
Vietnam welcomed Japan's maritime pledge made earlier on Abe's trip, his third visit to the country as prime minister.
"Both sides agreed on the importance of ensuring the maritime security on the issue of the South China Sea and promoting to resolve conflict by peaceful means (and) respecting international law," Vietnamese Prime Minister Nguyen Xuan Phuc said.
Vietnam and China have traded barbs over disputed territory in the South China Sea, where Beijing has built islands capable of hosting military installations.
Tokyo has also sparred with Beijing over its territorial claims in the East China Sea, and both Japan and Vietnam have repeatedly stressed that maritime disputes should be addressed according to law.
Japan has made similar gifts of patrol vessels and aircraft to the Philippines, which also has competing maritime claims with China.
Tokyo is an increasingly vital ally to Vietnam -- it is the country's largest aid donor, the second largest foreign investor and a key trading partner.
At their meeting Monday, both sides pledged to keep trade ties alive in the wake of a promise by US President-elect Donald Trump to scrap the massive Trans-Pacific Partnership on his first day in office.
"We must create free, fair and rules-based market... we should all aim at the early entry into force of TPP," Abe said.
Abe, who has previously said the TPP would be "meaningless" without the US, added that he he wants to meet the US leader "as soon as possible after he takes office" on Friday.
Abe was the first foreign leader to meet Trump after his shock election victory in November and on Monday he described the US-Japan alliance as "rock solid".
His six-day swing through Asia-Pacific also took him to the Philippines, Australia and Indonesia before his final stop in Vietnam.
Climate projects and waste management were also included in Japan's aid package to Vietnam announced Monday.
Vietnam has come under fire for failing to enforce environmental regulations, especially in the industrial sector. Last year, Taiwanese steel firm Formosa was blamed for a toxic waste dump that killed tonnes of fish along Vietnam's central coast.
The leaders also announced a visit by Japan's emperor and his wife in the spring.