By Michael Martina and Mai Nguyen
BEIJING/HANOI (Reuters) - China and Vietnam have reached agreement on managing their dispute in the South China Sea through friendly talks, a senior Chinese diplomat said on Friday, following an ugly spat over the summer between the two communist neighbours.
The countries have long been at loggerheads over the strategic waterway, through which more than $3 trillion in cargo passes every year, with Vietnam having emerged as the most vocal opponent of China's claims to the majority of the regional sea.
A scheduled meeting between their foreign ministers in August was cancelled on the sidelines of a regional gathering in Manila amid an argument about militarization in the South China Sea and island-building.
Hanoi and Beijing, however, have sought to get relations back on track, with a top Chinese leader telling his Vietnamese hosts in September that their two communist parties have a "shared destiny".
Chinese Foreign Minister Wang Yi met senior Vietnamese officials in Hanoi this week.
Speaking before Chinese President Xi Jinping goes to Vietnam next week for a state visit and to attend a summit of Asia Pacific leaders, Chinese Assistant Foreign Minister Chen Xiaodong said national leaders of the two countries have had many "deep, frank" discussions on maritime issues.
"They reached an important consensus," Chen told a news briefing.
"Both sides will uphold the principle of friendly consultations and dialogue to jointly manage and control maritime disputes, and protect the bigger picture of developing Sino-Vietnam relations and stability in the South China Sea."
Vietnam's Deputy Prime Minister Pham Binh Minh said in a statement late on Thursday that he had proposed in a meeting with Wang that the two countries resolve disputes based on common sense and international law.
The latter point is a contentious one in the South China Sea, where Vietnam has long said China's extensive territorial claim has no legal basis.
China and Southeast Asian countries are willing and able to handle the South China Sea issue themselves, Chen said, in an oblique reference to the United States, whose comments on the dispute and naval patrols in the waterway have angered Beijing.
"We also hope countries outside the region can objectively view positive change in the South China Sea situation, and do more for peace and stability in the region," Chen said.
China has appeared uneasy at Vietnamese efforts to rally Southeast Asian countries over the busy swathe of sea as well as at its neighbour's growing defence ties with the United States, Japan and India.
In July, under pressure from Beijing, Vietnam suspended oil drilling in offshore waters also claimed by China.
Brunei, Malaysia, the Philippines and Taiwan also claim parts of the South China Sea, and dispute China's contention of sovereignty over most of the waters.
China has undertaken more construction and reclamation in the South China Sea, recent satellite images show, and is likely to more powerfully reassert its claims over the waterway soon, regional diplomats and military officers say.
Xi is also visiting Laos during his tour, another communist-run county once firmly in Vietnam's orbit, but which is now increasingly close to Beijing and the site of several major Chinese infrastructure projects.
(Reporting by Michael Martina in BEIJING and Mai Nguyen in HANOI; Writing by Ben Blanchard; Editing by Tom Hogue)