The communist neighbours have long-sparred over the sea -- to which Brunei, Taiwan and the Philippines also have partial claims -- through which $5 trillion in shipping trade passes annually.
China has built artificial islands and airstrips capable of hosting military installations in the sea, which is believed to sit atop vast oil and gas deposits.
Hanoi and Beijing agreed Monday to keep the peace in the sea, the countries said in a joint statement during a state visit to Hanoi by Chinese President Xi Jinping.
Tensions flared earlier this year when Vietnam suspended an oil exploration project in an area off its coast that China claims as its own, reportedly following pressure from Beijing.
Also Read
Relations hit rock bottom in 2014 when Beijing moved an oil rig into waters claimed by Vietnam, sparking weeks of protests.
On Sunday US President Donald Trump offered to use his negotiation prowess to help Vietnam resolve the long-simmering tensions.
But on Monday, China appeared to take a swipe at his offer.
"We hope non-regional countries can respect the regional countries' efforts in maintaining the regional stability of the South China Sea, and play a constructive role in this aspect," Chinese foreign ministry spokesman Geng Shuang said at a regular press briefing.
Trump was in Manila Monday for meetings with the 10- member Association of Southeast Asian Nations (ASEAN) and several other countries.
China insists the code must not be legally binding, a demand to which Southeast Asian countries have so far acquiesced.
Vietnam had been pushing for the code to be legally binding but ASEAN agreed in August that it would not have any legal force.
China agreed in 2002 to begin talks on a code, but has delayed actually doing so while carrying out its expansionist strategy.
Disclaimer: No Business Standard Journalist was involved in creation of this content