China's leader-in-waiting Xi Jinping has held his first talks with a foreign official since vanishing from the public eye.

Meeting US Defence Secretary Leon Panetta, Mr Xi said he wanted to advance ties with the United States.

Vice-President Xi's disappearance had prompted widespread rumours that he was ill, or worse, ahead of this year's five-yearly Communist Party Congress when he is expected to be named party chief.

Mr Panetta's visit has come at a fraught time for China, which is involved in an escalating row with Japan over who owns a small group of islands in the East China Sea.

"I believe that your visit will be very helpful in further advancing the state-to-state and mil-to-mil (military-to-military) relations between our two countries," Mr Xi told Mr Panetta during a welcoming ceremony at the Great Hall of the People.

The dispute has triggered widespread anti-Japanese protests in China in the past few days.

Critics in China believe that a US move to shift its strategic focus to the region has encouraged countries such as Japan to be more bold when dealing with China.

However, Mr Panetta, in remarks later to cadets at a Chinese military academy, sought to convince the Chinese government that the shift in focus was not an attempt to hem in China, whose neighbours have expressed concern about its expanding military reach.

Mr Panetta told students at the Armoured Forces Engineering Academy that expanding US missile defences in Asia were aimed at North Korea, not China, and that deepening US defence ties with allies in the region were to reinforce a security system that had helped China flourish.

"Our rebalance to the Asia-Pacific region is not an attempt to contain China," he said.

"It is an attempt to engage China and expand its role in the Pacific. It is about creating a new model in the relationship of two Pacific powers."

Mr Panetta's remarks echoed the message he has delivered in meetings with defence and political leaders during his three-day visit.

However, the message is difficult to sell to a sceptical Chinese audience concerned about US missile defences in Japan, expanding military ties with the Philippines and suspicion that the US wants military access to Cam Ranh Bay in Vietnam.

"The Chinese just don't buy it. They are not convinced," said Bonnie Glaser, a China analyst at the Centre for Strategic and International Studies, a Washington think-tank.

"Moreover they see the US as emboldening nations like Japan, the Philippines and Vietnam who have territorial disputes with China to directly confront Beijing," she said.

Mr Panetta has said the US takes no position in the territorial dispute between Japan and China, though acknowledged the US defence obligations in the event of an attack on Japan.

Mr Panetta said that while the US and China would not always agree on issues, it was important to look beyond the disagreements to areas where they could work cooperatively together.

"We cannot let those disagreements and challenges blind us to the great opportunities that exist," he said. "If we work together and cooperate together, we can solve problems together."

Mr Panetta said to do that, the US and China needed to focus on building confidence and understanding between their two militaries by enhancing the quality and frequency of their dialogue and interaction.

He cited combating terrorism, responding to natural disasters, ensuring maritime security and preventing the spread of weapons of mass destruction, piracy and drug trafficking as areas where the US and Chinese militaries could cooperate to their mutual benefit.