The US and Chinese presidents stressed enhanced cooperation in a cordial joint appearance in Beijing on Wednesday, but laid bare disagreements with blunt remarks on protests in Hong Kong and other issues.

The surprise announcement of their plans to cut carbon emissions dominated Barack Obama’s visit, with the US president saying it had shown “that US-China cooperation cannot only be good for the two countries, but the world as a whole”.

He and his counterpart, Xi Jinping, covered a broad range of vexed issues for the bilateral relationship, ranging from regional territorial disputes to cyberspying and trade, in several hours of talks before addressing the media at the Great Hall of the People.

China has presented the bilateral relationship as “a new model of great power relations”, with Xi telling reporters: “It’s natural that we don’t see eye to eye over every issue. But there have always been more common interests than differences between us.”

Obama praised Xi’s willingness to engage constructively, adding: “Where we have disagreements we will be candid and clear about our intentions and work to narrow those differences where possible.”

He said the US wanted and supported “the continuing rise of a China that is peaceful, prosperous and stable and plays a responsible role in the world”.

The men spoke for five hours during and after dinner on Tuesday; two hours longer than scheduled, officials said.

Deals on ending tariffs for IT products and extending visas for each other’s citizens had already been announced. The countries have also agreed to work together on counter-terrorism and to improve communications between their militaries, reducing the risk of accidents or miscalculations.

Behind specific disputes lie fundamental differences over values, US concerns about a rising and more assertive China and Chinese anxieties that the US is seeking to contain it by “rebalancing” foreign policy to Asia.

Obama said the two men had a “very healthy exchange” on human rights and America’s determination to speak out for freedoms it believes are universal.

“[These are] rights we believe are the birthright of all men and women wherever they live – whether it is in New York or Paris or Hong Kong,” he said pointedly.

Chinese media and authorities have repeatedly suggested that foreign forces have stirred up the pro-democracy protests in Hong Kong.

The US leader said he had been unequivocal in saying that his country had no such involvement and that the issues were for the people of Hong Kong and China to decide. But he added that elections in the region should be “transparent, fair and reflective of the opinions of people there”.

Beijing has promised universal suffrage for the election of the next chief executive but demonstrators complain that candidates will be so tightly controlled that it will be fake or “Iranian-style” democracy.

Xi responded: “Hong Kong affairs are exclusively China’s internal affairs and foreign countries should not interfere in any form or fashion.

“OccupyCentral is an illegal movement in Hong Kong. We are firmly supportive of the efforts of the government of the special administrative region to handle the situation … It goes without saying that law and order must be maintained in any place.”

On Wednesday, Hong Kong’s chief secretary, Carrie Lam, warned protesters to clear sites they have occupied for more than six weeks or risk arrest. Hundreds are still participating in the demonstrations.

Some activists have said they plan to occupy the British consulate on 21 November because the UK has not stood up to China over the implementation of the handover agreement, which included the commitment to universal suffrage.

Xi told the press briefing in Beijing it was “a fact recognised by all the people in the world” that China had made enormous progress on human rights, but said that the issue was always a work in progress.

The leaders took one question from US media and one from Chinese. Asked about the refusal to grant new visas to the New York Times and Bloomberg - Xi responded, apparently reading from notes: “China protects our citizens’ freedom of expression and the normal rights and interests of media organisations in accordance with law, but media outlets must obey Chinese laws and regulations.

“When a car breaks down on the road, perhaps we need to get out of the car and see where the problem lies … In China we say: ‘The party who created the problem should be the one to help resolve it.’”

The two media outlets have been unable to obtain visas for new journalists since they reported on the wealth of relatives of senior leaders, including Xi.

Obama said he had also emphasised “the need for a level playing field so foreign companies can compete fairly, including against Chinese state-owned enterprises” and the need to protect intellectual property and trade secrets – “especially against cyber-threats”. The US has repeatedly accused China of cyber-hacking while China has claimed it is the greatest victim of such attacks.