US President Barack Obama has said that alleged Chinese cyber attacks are "not acceptable", ahead of a visit from Chinese leader Xi Jinping.
Several hacks on US institutions have been blamed on China, including one involving millions of government staff.
Mr Obama said the US needed to be more rapid in its response to such attacks.
Separately, the White House said Mr Obama will no longer stay at New York's Waldorf Astoria hotel, which was bought by a Chinese company last year.
White House Spokesman Josh Earnest would not comment on whether the purchase raised concerns about Chinese spying.
"There are a range of considerations that influence where the president will stay when he's not at the White House... everything from available space, to cost and to security," Mr Earnest said.
'We will win'
Mr Obama made his remarks after meeting members of the US military at Fort Meade, Maryland, with Mr Xi due in Washington later this month.
"We have been very clear to the Chinese that there are certain practices that they are engaging in, that we know are emanating from China and are not acceptable."
He suggested the two sides would have to agree on common rules in cyberspace, arguing "there comes a point at which we consider this a core national security threat and we will treat it as such".
But he said that China should fear confrontation online: "I guarantee you we will win if we have to."
But China has said it is the victim of US cyber attacks, allegations Beijing said were supported by the revelations from US intelligence contractor Edward Snowden.