President Trump and Chinese President Xi Jinping are shown at the Great Hall of the People in Beijing on Nov. 9, 2017. (Damir Sagolj/Reuters)

THE UNITED STATES and China are at a hinge point in the most important bilateral relationship of the 21st century. What started last year as a trade dispute, one that just last month seemed close to settlement, threatens to escalate into a new Cold War with potentially devastating consequences for both countries — and the world. Now substantially integrated, the two largest economies could unwind from each other; a technological schism could create separate platforms for communications and other high-tech systems. Flows of students and scientists and venture capital could dry up. Cooperation on strategic problems of mutual interest, such as North Korea and climate change, could cease. And countries from Southeast Asia to Latin America could be forced to pick sides.

This is an outcome that both the Trump administration and the Chinese regime of Xi Jinping should be seeking to avoid. Instead, both appear to be pursuing policies that make it more likely. In the case of the Trump administration, the slide toward confrontation is being driven by reckless and sometimes senseless measures ungoverned by a coherent strategy.

To be sure, there is a consensus in Washington that policy toward China needs to change from that of recent decades. Successive U.S. presidents bet that growing trade and investment between the two countries and steady diplomatic engagement could coax the Communist Party regime into becoming a responsible global player that respected the U.S.-backed international order and gradually became more free at home. Mr. Xi’s regime has shattered that hopeful vision.

It is not just that this Chinese ruler has concentrated personal power and shut down all hints of pluralism in the political system. His regime is pioneering a new, high-tech form of totalitarianism, in which human lives will be controlled by omniscient databases and ubiquitous surveillance systems — and it is offering this as a model of governance for the rest of the world. China would foster societies where the Internet is a tool for state power rather than personal freedom. Its technology companies are already marketing the systems that have enabled a vast gulag of concentration camps in the Xinjiang region to authoritarian regimes in Africa.

Mr. Xi is flouting international law and treaties in the South China Sea, where the Chinese military is building a string of bases aimed at establishing Beijing’s hegemony over vital shipping lanes. A Chinese arms buildup appears designed to enable the subjugation of Taiwan and the expulsion of U.S. forces from the Western Pacific. Meanwhile, Beijing is still seeking unfair advantage for Chinese companies by trying to force multilateral firms to hand over their technology in exchange for access to its market. Promises by Mr. Xi to cease the stealing of technology through cyberoperations have been brazenly violated.

The United States has little choice but to push back against these aggressions and Mr. Xi’s disturbing ideological model. But the Trump administration has gone about it in the wrong way. It has largely ignored the most reprehensible and dangerous Chinese behavior, including its genocidal campaign in Xinjiang and takeover of the South China Sea, while launching a tariff war in pursuit of an improvised and shifting mix of economic concessions. President Trump wants to force a reduction in the U.S.-China trade deficit, a pointless goal that reflects his ignorance of basic economics. While some of his advisers seek an end to unfair Chinese treatment of U.S. companies, others appear bent on blocking China’s attempt to develop high-tech industries or destroying the ones it has.

A turning point came last month after Mr. Xi abruptly retreated from a tentative agreement resolving the trade dispute. Mr. Trump reacted not just by moving to expand tariffs on Chinese goods but also by restricting sales by U.S. companies to Huawei, China’s telecommunications champion. There are legitimate concerns about Huawei’s connections to the Chinese government, and a good argument for excluding its products from sensitive communications networks in the United States and its allies — though U.S. agencies have yet to back up their warnings with clear evidence. But Mr. Trump’s measure threatens to destroy the company, or else force it to develop its own versions of chips and operating systems it now obtains from the West. If the ban is fully enacted and China retaliates against U.S. tech companies, as it has threatened to do, the decoupling of the two countries’ tech supply chains, as well as other parts of their economies, could begin in earnest.

That would be a bad outcome for both Americans and Chinese. It would make both countries poorer while sharply raising the odds that they will slide toward a larger conflict. Competition between the United States and China should not become a zero-sum game, as it was with the Soviet Union. Rather, the United States should seek to maintain flows of trade, investment, people and expertise between the two economies, while working patiently to establish fairer and more equitable terms for that interchange. Where it should be uncompromising is in challenging China’s military expansionism and its attempt to create and export technologies of repression. A productive economic relationship would provide leverage and make it more likely that China’s malign regional and global ambitions can be contained.

To pursue those policies, the United States needs its allies. Many nations in Europe and Asia share Washington’s concerns about the Xi regime. Yet Mr. Trump has pursued his trade war with Beijing unilaterally, while threatening to launch new tariff attacks against key partners, such as Japan and Germany. He walked away from what could have been one of the most powerful tools to contain Beijing, the Trans-Pacific Partnership.

Mr. Trump’s tactics have failed to accomplish even his narrowest economic aims. Now he risks triggering a larger conflict whose dimensions and potential consequences ought to alarm Americans who hope for a peaceful and prosperous 21st century.