China Vietnam
China's State Councillor Yang Jiechi with Vietnam's Deputy Prime Minister and Foreign Minister Pham Binh MinhReuters

China and Vietnam have agreed to seek a "lasting resolution" to a long-running territorial dispute over part of the South China Sea that both sides claim as their own.

China's top diplomat Yang Jiechi travelled to Hanoi to meet with the Vietnamese Foreign Minister Pham Binh Minh and the pair appeared in a conciliatory mood, exchanging smiles and handshakes after the meeting.

China's foreign ministry said the two sides had agreed at the meeting to "appropriately handle the maritime problem."

Both China and Vietnam would "properly use a border negotiation mechanism between the two governments to seek a basic, lasting resolution both sides can accept," China's foreign ministry said, adding that both sides agreed to "manage and control maritime disputes, not take any acts to complicate or expand the disagreement."

The mood reflected a shift in relations between Beijing and Hanoi since the summer, when the two countries' navies clashed in the South China Sea, both sides reporting that the other had rammed their ships.

The long-running dispute escalated dramatically in May when China deployed a massive oil drilling rig in disputed waters close to the Paracel Island chain. The $1bn (£0.6bn, €0.8bn) rig was later moved out of the waters in July, when China said it had finished its work.

The maritime clashes that erupted after the rig's deployment provoked anti-Chinese rioting on mainland Vietnam, leading to a number of deaths and extensive damage to a number of factories that the rioters thought were Chinese.

Since then, the two sides have reached an uneasy stalemate, with Vietnam boosting ties with its old adversary the United States and a number of other nations involved in territorial disputes with Beijing.

"At present, Sino-Vietnamese relations are at a crucial stage of improvement and development," the ministry quoted Yang as saying.

Annual trade between the two Communist countries has reached $50bn in recent years but tensions remain over China's perceived designs on the South China Sea.

"Vietnam-China relations developing healthily and stably is suitable with the desire and fundamental interests of the two countries, benefiting peace, stability and development," Vietnam's foreign ministry said in a statement. "Both sides will together make an effort to seriously implement the agreements."