The nationalistic Global Times tabloid said on Friday in an editorial that Washington and Pyongyang were playing a "reckless game" that could lead to "miscalculations and a strategic war".
"China should also make clear that if North Korea launches missiles that threaten US soil first and the US retaliates, China will stay neutral," the editorial said.
However it added: "If the US and South Korea carry out strikes and try to overthrow the North Korean regime and change the political pattern of the Korean peninsula, China will prevent them from doing so." The commentary came after Washington warned North Korea this week it faced "fire and fury like the world has never seen" if it continued to threaten the US with its missile and nuclear programmes.
That prompted a defiant Pyongyang to threaten a missile attack on Guam, a tiny US territory in the Pacific that is home to major US air and naval facilities.
China - which has been accused by the US of not doing enough to rein in its longtime ally - has maintained that political dialogue is the only solution.
Al Jazeera's Adrian Brown, reporting from Beijing, said the commentary gave an inkling of China's official stance. "The editorial also says that if the US carries out strikes and tries to overthrow the North Korean regime then China would prevent that from happening. But it doesn't specify how Beijing would do that," he said.
"Now of course China is the only ally that North Korea has but China has now agreed to tougher UN sanctions against North Korea, which means it will no longer be importing coal, iron, lead and seafood. Now if China does have influence over North Korea, we have yet to really see it." As tension soars in the region, South Korea's media called on Friday for Seoul to build nuclear weapons of its own to defend itself.
South Korea, which fought a war alongside the US with the North that ended in a stalemate in 1953, is highly technologically advanced and analysts estimate it could develop an atomic device within months of deciding to do so.
"Now is time to start reviewing nuclear armament," the Korea Herald said in an editorial.
The South, which hosts 28,500 American troops, is banned from developing its own nuclear weapons under an atomic energy deal it signed in 1974 with the US, which instead offers Seoul a "nuclear umbrella" against potential attacks.
But with Pyongyang regularly threatening to turn Seoul into a "sea of flames" - and nagging questions over Washington's willingness to defend it if doing so put its own cities in danger of retaliatory attacks - the South's media are leading calls for a change of tack.
After Pyongyang conducted two successful tests of an intercontinental ballistic missile last month, putting much of the mainland US within reach, the paper warned: "Trust in the nuclear umbrella the US provides to the South can be shaken." The US stationed some of its atomic weapons in the South following the 1950-53 Korean War, but withdrew them in 1991 when two Koreas jointly declared they would make the peninsula nuclear-free.
But Pyongyang carried out its first nuclear test in 2006 and formally abandoned the deal in 2009.
A conflict between the North and the US could have devastating consequences for Asia's fourth-largest economy, with Seoul within range of Pyongyang's vast conventional artillery forces.
"A catastrophe is looming," the South's top-selling Chosun daily said in an editorial this week. "All options, even those considered unthinkable so far, must be on the table." North Korea has staged five atomic tests as it seeks to develop a nuclear-tipped missile capable of hitting the continental United States.