The agreement was announced in a joint statement after Chinese President Xi Jinping made a state visit to the Vietnamese capital of Hanoi on Monday.
The two sides agreed to "well manage disputes at sea, make no moves that may complicate or expand disputes, (and) maintain peace and stability on the East Sea," the Vietnamese version of the statement said, using another name for the contested waters.
China's official Xinhua news agency also reported that Beijing and Hanoi had "reached an important consensus in accordance with leaders of the two parties and countries, to appropriately manage maritime issues, steadily advance all forms of maritime cooperation, including joint development, and jointly strive to uphold peace and stability in the South China Sea."
Meanwhile, Vietnam’s state television said the Chinese president had told his Vietnamese counterpart Tran Dai Quang that he wanted to discuss a “code of conduct” in the disputed sea with the 10-member Association of Southeast Asian Nations (ASEAN) during three-day summit of the organization which is underway in the Philippines.
Hanoi is in dispute with Beijing over territory in the South China Sea. Tensions over the matter spiked earlier this year when Vietnam started and then had to suspend an oil exploration project in an area of the sea.
On Sunday, US President Donald Trump, who was in Vietnam as part of his five-nation tour of Asia, offered to help resolve the ongoing territorial dispute between Hanoi and Beijing in the South China Sea.
“If I can help mediate or arbitrate, please let me know,” Trump told the Vietnamese president, boasting about what he said were his “very good” mediation skills.
Trump’s comments were met with harsh response from the Chinese side, with Foreign Ministry spokesman Geng Shuang saying at a regular press briefing in Beijing that "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.”
China’s sovereignty claim over the sea has also been challenged by four other regional nations – Taiwan, Brunei, Malaysia and the Philippines.
Washington has constantly accused Beijing of undertaking a land reclamation program through building artificial islands in the sea and deploying weapons there.
China has rejected the claim, saying the islands serve civilian purposes only.
The US has so far sent several of its warships to the South China Sea to protect what it calls “freedom of navigation” there, but Beijing accuses Washington of interfering in the regional issues and deliberately stirring up tensions.