China and Vietnam agreed Monday to use an existing border dispute mechanism to find a solution to their territorial dispute in the South China Sea, saying they do not want it to affect relations.

The two countries have sought to patch up ties since the row erupted in May, triggered by China's deployment of a drilling rig in waters claimed by the communist neighbors, which lead to confrontations at sea between rival vessels and violent anti-Chinese protests in Vietnam.

After a meeting between China's top diplomat, State Councilor Yang Jiechi, and Vietnam Foreign Minister Pham Binh Minh in Hanoi, China's Foreign Ministry said they had agreed to "appropriately handle the maritime problem."