China and Vietnam agreed to resume military ties and resolve their maritime disputes in high-level meetings, China's official Xinhua News Agency said, marking the first signs that tensions over rival territorial claims may be easing.

The relationship between the two countries grew tense this year after China deployed an oil rig in South China Sea waters claimed by Hanoi, triggering anti-China riots in Vietnam that destroyed foreign factories and led to an exodus of thousands of Chinese workers.

In a meeting with Vietnamese Defense Minister Phung Quang Thanh on Friday in Beijing, Chinese Vice President Li Yuanchao called on the two countries to enhance political trust and manage maritime disputes, Xinhua said.

Thanh also met with his Chinese counterpart, Chang Wanquan, and both sides decided to resume military ties and "play a positive role" in handling maritime disputes, the news agency said.

Comments from Vietnam were not immediately available on Saturday.

Chinese Premier Li Keqiang met his Vietnamese counterpart, Nguyen Tan Dung, on Thursday on the sidelines of the Asia-Europe Meeting in Milan, Italy, Xinhua said. The two sides agreed to properly handle bilateral maritime differences and keep bilateral ties on the right track, it said.