WASHINGTON (Reuters) - President Barack Obama announced on Friday that he had reached a “common understanding” with Chinese President Xi Jinping on curbing economic cyber espionage, but threatened to impose U.S. sanctions on Chinese hackers who persist with cyber crimes.

U.S. President Barack Obama (L) shakes hands with Chinese President Xi Jinping as he welcomes him to the White House in Washington September 25, 2015 REUTERS/Kevin Lamarque

The two leaders also unveiled a deal to build on a landmark emissions agreement struck last year, outlining new steps they will take to deliver on pledges they made then to slash their greenhouse gas emissions.

Speaking after White House talks during Xi’s first U.S. state visit, Obama quickly homed in on the thorniest dispute between the world’s two biggest economies - growing U.S. complaints about Chinese hacking of government and corporate databases, and the suspicion in Washington that Beijing is sometimes behind it.

“It has to stop,” Obama told reporters at a joint news conference in the White House Rose Garden, with Xi standing beside him. Obama said he and Xi made “significant progress” on cyber security.

But he added warily: “The question now is, are words followed by actions?” and made clear he is prepared to levy sanctions against cyber criminals.

The two leaders said they agreed that neither government would knowingly support cyber theft of corporate secrets or business information.

But the agreement stopped short of any promise to refrain from traditional government-to-government cyber spying for intelligence purposes. That could include the massive hack of the federal government’s personnel office this year that compromised the data of more than 20 million people. U.S. officials have traced that back to China but have not said whether they believe the government was responsible.

Xi reiterated China’s denial of any government role in the hacking of U.S. corporate secrets and said the best way to address the problem was through bilateral cooperation and not to “politicize this issue.”

“Confrontation and friction are not the right choice for both sides,” he said. China has routinely insisted that it too is a victim of cyber hacking.

Analysts said the agreement was significant. James Lewis, senior fellow at the Center for Strategic and International Studies, said the leaked plan for sanctions helped push the Chinese toward a better-than-expected agreement, but noted that Beijing also got Washington to consider some Chinese concepts for norms of behavior.

POMP AND TECH

Obama hosted a lavish black-tie state dinner for Xi on Friday night, featuring Maine lobster and Colorado lamb for about 200 guests, with technology executives featured among them.

Seated with Obama and Xi at the head table were Apple CEO Tim Cook, Satya Nadella of Microsoft, Facebook’s Mark Zuckerberg and Salesforce.com’s Marc Benioff.

In their dinner toasts, both leaders focused on the theme of friendship. But Obama also referenced the tensions. “There will be times when there are differences between our two countries. It’s inevitable,” Obama said, also gently urging China to accept diverse views and “uphold the rights” of all people.

Earlier in the day, the two men struck a serious, businesslike tone when they appeared before reporters, showing little sign of close personal rapport as Obama laid out concerns with Beijing’s economic policies, territorial disputes with its neighbors and its human rights record.

As the two leaders spoke, dozens of pro- and anti-Xi protesters gathered near the White House grounds, waving flags, beating drums and shouting slogans.

U.S. and Chinese officials sought to cast their talks in a favorable light by showcasing at least one area of cooperation – the global fight against climate change.

As part of their agreement, Xi announced that China, the world’s biggest emitter of greenhouse gases, will launch a national carbon cap-and-trade system in 2017 to help contain the country’s emissions.

For Obama, the deal with China strengthens his hand ahead of a global summit on climate change in Paris in December.

But disagreements on other issues loomed.

Obama told Xi after a 21-gun salute at a morning welcoming ceremony that the United States would continue to speak out over its differences with China, but he reiterated that the United States welcomes the rise of a China that is “stable, prosperous and peaceful.”

Xi, who faces rising nationalism at home as well as pressure to get China’s economic house in order, called for “mutual respect.”

In their talks, Obama also pressed Xi to follow through on economic reforms and not discriminate against U.S. companies operating in China. Some analysts believe Obama has more leverage due to China’s slowing economic growth, which has destabilized global markets.

At the same time, the Obama administration is still at a loss about how to curb China’s assertiveness in the South China Sea, where Beijing has continued to reclaim land for potential military use despite conflicting claims with its neighbors.

Xi defended his government’s “right to uphold our own territorial sovereignty” and denied any plan to use its island-building efforts to create military strongholds.

In a reminder of potential flashpoints, the United States and China also finalized a plan aimed at reducing the risk of aerial collisions between warplanes in areas such as the South China Sea through adoption of common rules of behavior.