BEIJING — President Obama and President Xi Jinping promoted the virtues of cooperation between China and the United States on Wednesday, drawing an unusually productive state visit to a close with a news conference that nevertheless laid bare stubborn differences over issues like the Hong Kong pro-democracy demonstrations and press freedom.
Announcing a landmark agreement to confront climate change, Mr. Obama and Mr. Xi both portrayed it as an example of how the world's two largest economies could collaborate on the world's most pressing problems, even as they compete in many other areas.
"When China and the U.S. work together, we can become an anchor of world stability and a propeller of world peace," Mr. Xi said. Mr. Obama echoed that sentiment, calling the climate change agreement a milestone in the countries' relations that "shows what's possible when we work together on an urgent global challenge."
But it was the differences that were cast in sharp relief during a rare question-and-answer session after the presidents delivered their statements. During the planning for Mr. Obama's visit, the White House had lobbied intensively for reporters' questions to be taken, and the Chinese authorities relented only a day before the leaders stood together in the Great Hall of the People.
Initially, Mr. Xi appeared to ignore two questions from a reporter for The New York Times: whether China feared that the Obama administration's pivot to Asia represented an effort to contain China, and whether China would ease its refusal to issue visas to some foreign correspondents in light of a broader visa agreement with the United States.
After first taking an unrelated question from a Chinese state-run newspaper — appearing to draw a bemused reaction from Mr. Obama — Mr. Xi circled back, declaring that the visa problems of news organizations, including The Times, were of their own making. He evinced little patience for the foreign news media's concerns that they were being penalized for unfavorable news coverage of Chinese leaders and their families.
Mr. Xi said that China protected the rights of media organizations, but that the organizations needed to abide by the rules of the country. "When a certain issue is raised as a problem, there must be a reason," he said, apparently acknowledging a link between news coverage and the refusal to extend the visas.
Mr. Xi used a Chinese metaphor to describe the travails of The Times and other organizations, saying they were like a faulty car. "When a car breaks down on the road, perhaps we need to step down and see what the problem is," he said.
In a passage that was not translated into English, the president added that "the Chinese say, 'Let he who tied the bell on the tiger take it off'" — a saying that can also be translated as, "The one who created the problem should be the one who solves it."
Mr. Xi also bluntly warned the United States and other foreign countries not to get involved in the pro-democracy demonstrations in Hong Kong, which he dismissed as illegal, responding to a question to Mr. Obama about rumors in the Chinese media that the United States is fomenting the unrest there.
"Hong Kong's affairs are exclusively China's internal affairs, and foreign countries should not interfere in Hong Kong's affairs in any fashion," the Chinese leader declared. "It goes without saying that law and order must be protected in any place."
The authorities in Hong Kong have issued increasingly strong warnings for protesters to clear the streets as Mr. Obama's visit and the Asia-Pacific Economic Cooperation summit meeting in Beijing have neared an end.
Mr. Obama said he had assured Mr. Xi that the United States had nothing to do with the protests in Hong Kong. "These are issues ultimately for the people of Hong Kong and China to decide," he said of the protests demanding fully democratic elections, though he voiced support for the right of free expression.
In general, Mr. Obama's references to human rights were carefully calibrated. He noted America's refusal to recognize a separate Taiwan or Tibet. He also praised China for its role in nuclear negotiations with Iran, its response to the Ebola outbreak in West Africa and its dealings with a nuclear-armed North Korea.
Mr. Obama played down a recent wave of virulently negative coverage of him and the United States in China's state-run media. Tough press coverage, he said, came with being a public official, whether in China or the United States. "I'm a big believer in actions, not words," he added.
White House officials told reporters that the president had called on a reporter for The Times in part because several of its China correspondents had been denied visas by the government.
The state-run Chinese television station CCTV did not broadcast the 48-minute news conference. "That would have been a deliberate decision by the central propaganda department, which everyone knows is even more hard-line than Xi Jinping," said Shi Yinhong, professor of international relations at Renmin University in Beijing.
Propaganda officials did not want the Chinese public to see President Obama talking about human rights and Tibet, Mr. Shi said, even though he said Mr. Obama had been gracious in not saying "hard things to annoy his host."