The warning from china's Ministry of Commerce came after US President Donald Trump said he was considering $100bn (£71.5bn) in extra tariffs on Chinese goods.
The ministry said: "If the US side disregards opposition from China and the international community and insists on carrying out unilateralism and trade protectionism, the Chinese side will take them on until the end at any cost."
The two countries have been building towards a trade war since President Donald Trump moved to impose tariffs on US imports of steel and aluminium products - exempting the EU and many other nations, at least for now.
Mr Trump's protectionist agenda is aimed at saving US jobs and closing what he sees as a $504bn trade gap with China and deficits with other major economies.
His proposed measures also include tackling alleged intellectual property theft by Beijing but China has responded by threatening to target US agriculture as part of its own measures.
It has raised objections with the World Trade Organisation to the planned imposition of $50bn (£35.7bn) in tariffs over the technology issue.
On Thursday night stock markets had recovered some value as hopes grew that the two largest economies in the world would avert a damaging trade war.
Yun Sun, China expert at the Stimson Center think tank, said: "What we are seeing so far, although it's ugly and it's confrontational, it's still posturing.
"We have not yet seen the axe falling."
While Mr Trump has often praised Chinese President Xi Jinping for his cooperation over the North Korea nuclear problem, on other fronts the relationship between the two countries is getting worse.
Among the low points: The US national security strategy in December that named China, along with Russia, as a "revisionist power" threatening American interests; the US increasing its naval operations in the South China Sea; and legislation signed by Mr Trump last month calling for Cabinet-level official visits to Taiwan, a self-governing island that Beijing regards as part of Chinese territory.
More follows...