WASHINGTON — The United States has ordered China to close its diplomatic consulate in Houston by Friday, citing a nationwide pattern of espionage and attempted theft of scientific research by the Chinese military that is aided by diplomats.The order deals a major blow to the rapidly deteriorating relations between the two nations. China promptly vowed to retaliate, calling the move illegal.The State Department said in a statement that the closure was in response to repeated Chinese violations of American sovereignty, including “massive illegal spying and influence operations.”Secretary of State Mike Pompeo said at a news conference on Wednesday in Copenhagen, Denmark, that Chinese citizens stealing intellectual property in the United States had been a persistent problem. “We are setting out clear expectations as to how the Chinese Communist Party is going to behave,” he said. “And when they don’t, we are going to take actions that protect the American people, protect our security, our national security, and also protect our economy and jobs.”President Trump and his top national security aides have made harsh statements and speeches on China in recent weeks. Mr. Trump’s campaign strategists, anxious about his failures on the pandemic and the economy, have decided to roll out a blanket anti-China message.However, the president has a record of vacillating wildly on China: He has consistently expressed admiration of Xi Jinping, the Chinese leader; pleaded with Mr. Xi to help him win re-election; and explicitly endorsed or remained silent on China’s mass internment of Muslims and crackdown on civil liberties Hong Kong.On Tuesday night, hours after American officials delivered the shutdown order to the Chinese ambassador in Washington, consulate employees burned papers in open metal barrels in a courtyard of the Houston building, prompting police officers and firefighters to rush to the area, according to online videos and local news reports.The People’s Liberation Army “has been sending students both overtly and otherwise to American universities to study things to advance their own warfare advantages in the economic world and the rest,” David R. Stilwell, assistant secretary for East Asia and the Pacific, said in an interview Wednesday morning. “We took a practical step to prevent them from doing that.”“At the epicenter of all these activities facilitated by the P.R.C. mission is this consulate in Houston,” he added, referring to the People’s Republic of China. “It has a history of engaging in subversive behavior.”Mr. Stilwell declined to give details of all the incidents related to the consulate. But he said the Houston consul general, the top Chinese official in that mission, and two other diplomats were caught recently engaging in questionable activity past the security check area in George Bush Intercontinental Airport. It occurred, he said, as Chinese citizens were awaiting the takeoff of a charter flight to China that the Chinese government had arranged because of air travel restrictions during the pandemic. The diplomats were escorting certain travelers to the gate area, and Air China had paperwork with false birth dates for the diplomats, he added.He said that some of attempted scientific thefts uncovered in the United States could be related to global efforts to develop a vaccine for the new coronavirus.American officials might also have targeted the Houston consulate because closing it could end up being less costly to Washington than shutting down another mission, since the American “sister” consulate, in the Chinese city of Wuhan, had already been evacuated by the State Department after the initial coronavirus outbreak in that city. Beijing might order the formal closure of that consulate as a reciprocal act.The Chinese Embassy in Washington did not reply to emailed questions about the espionage and theft accusations.The Houston consulate has about 60 employees. There are six other Chinese diplomatic missions in the United States: the embassy in Washington, an office at the United Nations and consulates in New York, Los Angeles, San Francisco and Chicago.The Trump administration’s decision was a significant escalation of its effort to tighten the reins on Chinese diplomats, researchers, scholars, journalists and others in the United States. It comes during rising tensions that have been inflamed by the pandemic and Beijing’s repressive moves in Hong Kong, and that now touch on virtually all aspects of the relationship.The restrictions have included issuing travel rules for diplomats and requiring several Chinese state news organizations to register as diplomatic entities while limiting their visas. The administration is also considering a travel ban for members of the Communist Party and their families. Such a move, if enacted, could affect an estimated 270 million people, and it has been widely criticized as too sweeping to be practical.In May, the Trump administration announced a travel ban on students and researchers of graduate-level and higher who have ties to Chinese military institutions. Some officials estimated that would result in the expulsion of thousands of Chinese citizens from the United States.The Trump administration has repeatedly accused China of attempts to steal commercial and military secrets, allegations that Beijing has rejected.On Monday, the Justice Department announced visa fraud charges against Song Chen, a visiting Stanford University researcher accused of concealing her active membership in the Chinese military. In January, the F.B.I. announced it was seeking a Boston University student, Yanqing Ye, who had hidden her affiliation with the People’s Liberation Army when applying for a visa. American officials believe Ms. Ye is in China.In December, the U.S. authorities arrested a Chinese cancer-cell researcher, Zaosong Zheng, at Boston Logan International Airport and charged him with trying to smuggle 21 vials of stolen biological research back to China.The Justice Department said on Tuesday that it had indicted two Chinese hackers accused of trying to steal information about coronavirus vaccine research.Wang Wenbin, a spokesman for the Chinese Ministry of Foreign Affairs, urged the United States to reverse the decision immediately. “Otherwise China will certainly make legitimate and necessary reactions,” he said. His remarks suggested that China would, at a minimum, close a U.S. Consulate in China.Mr. Wang called the move unprecedented and illegal under international law, and described it as the latest in a series of aggressions.“For some time, the United States government has been shifting the blame to China with stigmatization and unwarranted attacks against China’s social system, harassing Chinese diplomatic and consular staff in America, intimidating and interrogating Chinese students and confiscating their personal electrical devices, even detaining them without cause,” he said.The Coronavirus Outbreak ›Frequently Asked QuestionsUpdated July 21, 2020I have antibodies. Am I now immune?Why do masks work?The coronavirus clings to wetness and enters and exits the body through any wet tissue (your mouth, your eyes, the inside of your nose). That’s why people are wearing masks and eyeshields: they’re like an umbrella for your body: They keep your droplets in and other people’s droplets out. But masks only work if you are wearing them properly. The mask should cover your face from the bridge of your nose to under your chin, and should stretch almost to your ears. Be sure there are no gaps — that sort of defeats the purpose, no?Is the coronavirus airborne?The coronavirus can stay aloft for hours in tiny droplets in stagnant air, infecting people as they inhale, mounting scientific evidence suggests. This risk is highest in crowded indoor spaces with poor ventilation, and may help explain super-spreading events reported in meatpacking plants, churches and restaurants. It’s unclear how often the virus is spread via these tiny droplets, or aerosols, compared with larger droplets that are expelled when a sick person coughs or sneezes, or transmitted through contact with contaminated surfaces, said Linsey Marr, an aerosol expert at Virginia Tech. Aerosols are released even when a person without symptoms exhales, talks or sings, according to Dr. Marr and more than 200 other experts, who have outlined the evidence in an open letter to the World Health Organization.What are the symptoms of coronavirus?What’s the best material for a mask?Cheng Xiaohe, an associate professor at the School of International Studies at Renmin University in Beijing, said the United States had never taken such a bold and divisive step since the two countries established diplomatic relations on Jan. 1, 1979.“If the relationship between China and the United States continues to deteriorate unchecked,” he said in a telephone interview in Beijing, “the next result will be the severing of diplomatic relations.”Closing a consulate is a serious diplomatic matter, but it is not without precedent in times of tensions.In 2017, the Trump administration ordered Russia to close its consulate in San Francisco, along with two annexes near New York and Washington, in retaliation for Russian restrictions on the number of American diplomats in Moscow. Those moves stemmed from the furor over Russia’s interference in the 2016 presidential election, the fallout from which is still felt, despite Mr. Trump’s outreach to the Russian president, Vladimir V. Putin.The effect of the Houston closure on relations — and travel — would in the short term be minimal compared with the diplomatic furor it has already sparked. The consulates principally process visas for travelers visiting China; the Houston consulate handled those for the southern states, from Texas to Florida. Travel between the two countries has been severely limited in any case because of the pandemic.Hu Xijin, an editor with The Global Times, a nationalist newspaper controlled by the Communist Party, called the American move outrageous, particularly given the short notice for Chinese diplomats to clear out within 72 hours.“This is a manifestation of panic,” he wrote in a note posted on Weibo, the Chinese social media platform. “It seems that Washington has no bottom line.”The newspaper also posted a poll on Twitter — which is banned in China — asking readers to vote on which American consulate to close. On the mainland, the United States has them in Shenyang, Shanghai, Chengdu, Guangzhou and Wuhan; it also has a consulate for Hong Kong and Macau in Hong Kong.The State Department evacuated its American staff from the Wuhan consulate in February during the outbreak of the coronavirus pandemic — a move that China at the time criticized as stoking panic. It has also significantly reduced operations at the embassy in Beijing and the other consulates, with many diplomats returning to the United States.In recent weeks, the department has begun to slowly return diplomats and their families — only to face rigorous health screening and quarantine rules that the Americans had complained were onerous and even in violation of the Vienna Conventions on diplomatic and consular relations.Keith Bradsher contributed reporting from Beijing, and Megan Specia from London. Claire Fu contributed research from Beijing.