(Reuters) - China and Vietnam avoided conflict over the South China Sea on Sunday when Chinese President Xi Jinping met Vietnam’s General Secretary Nguyen Phu Trong, hours after U.S. President Donald Trump offered to mediate maritime disputes. Relations between Hanoi and Beijing have been particularly strained since July, when China put pressure on Vietnam to stop oil drilling in a disputed area in the South China Sea. Vietnam’s state television said the Chinese president had told the Vietnamese leader he wanted to work with Southeast Asian nations on a code of conduct in the sea. China’s Xinhua news agency said China and Vietnam had agreed to properly handle maritime issues and strive to maintain peace and stability. Reefs and islands in the South China Sea are disputed by Brunei, Indonesia, Malaysia, the Philippines and Taiwan as well as China and Vietnam. Since Philippine President Rodrigo Duterte has grown closer to China, Vietnam has emerged as China’s main challenger in the area. China’s move to pressure Vietnam to stop oil drilling in a disputed area in July brought relations between the Communist neighbours to a low. Xi and Trump both held bilateral meetings with Vietnamese officials in the wake of a summit of the Asia Pacific Economic Cooperation in the Vietnamese city of Danang. Trump told Vietnam’s President Tran Dai Quang that he was prepared to mediate between claimants to the South China Sea and said China’s position was a problem. Trump and President Quang issued a joint statement underscoring the importance of free and open access to South China Sea, and saying parties should halt escalatory action.  (This story has been refiled to fix reversed word order in paragraph one.) 