RIO DE JANEIRO — China was on the defensive in Brazil.
The Trump administration had been warning allies across the globe to shun Huawei, the Chinese telecommunications giant, denouncing the company as a dangerous extension of China’s surveillance system.
Brazil, ready to build an ambitious 5G wireless network worth billions of dollars, openly took President Trump’s side, with the Brazilian president’s son — an influential member of Congress, himself — vowing in November to create a secure system “without Chinese espionage.”
Then pandemic politics upended everything.
With Covid-19 deaths rising to their highest levels yet, and a dangerous new virus variant stalking Brazil, the nation’s communications minister went to Beijing in February, met with Huawei executives at their headquarters and made a very unusual request of a telecommunication company.
“I took advantage of the trip to ask for vaccines, which is what everyone is clamoring for,” said the minister, Fábio Faria, recounting his meeting with Huawei.
Two weeks later, the Brazilian government announced the rules for its 5G auction, one of the biggest in the world. Huawei, which the government appeared to have barred just months before, will be allowed to participate.
The about-face is a sign of how politics in the region have been scrambled by the pandemic and Mr. Trump’s departure from the White House — and how China has begun to turn the tide.
China spent months batting away resentment and distrust as the place where the pandemic began, but in recent weeks its diplomats, pharmaceutical executives and other power brokers have been fielding scores of requests for vaccines from desperate officials in Latin America, where the pandemic is taking a devastating toll that grows by the day.
Beijing’s ability to mass-produce vaccines and ship them to countries in the developing world — while rich countries, including the United States, are hoarding many millions of doses for themselves — has offered a diplomatic and public relations opening that China has readily seized.
Suddenly, Beijing finds itself with enormous new leverage in Latin America, a region where it has a vast web of investments and ambitions to expand trade, military partnerships and cultural ties.
Only last year, President Jair Bolsonaro of Brazil, a right-wing leader who was closely aligned with Mr. Trump, disparaged the Chinese vaccine while it was undergoing clinical trials in Brazil, and shut down an effort by the health ministry to order 45 million doses.
“The Brazilian people WON’T BE ANYONE’S GUINEA PIG,” he wrote on Twitter.
But with Mr. Trump gone and Brazilian hospitals overwhelmed by a surge of infections, Mr. Bolsonaro’s government scrambled to mend fences with the Chinese and asked them to expedite tens of millions of vaccine shipments, as well as the ingredients to mass-produce the shots in Brazil.
The precise connection between the vaccine request and Huawei’s inclusion in the 5G auction is unclear, but the timing is striking, and it is part of a stark change in Brazil’s stance toward China. The president, his son and the foreign minister abruptly stopped criticizing China, while cabinet officials with inroads to the Chinese, like Mr. Faria, worked furiously to get new vaccine shipments approved. Millions of doses have arrived in recent weeks.
“With the desperation in Latin America for vaccines, this creates a perfect position for the Chinese,” said Evan Ellis, a professor of Latin American studies at the United States Army War College, who specializes on the region’s relationship with China.
It supplied hospitals with software to help doctors on the front lines of the pandemic. More recently, it donated 20 oxygen-making machines to the city of Manaus, where Covid patients suffocated to death in February as hospitals ran out of oxygen.
“May our joint efforts save lives!” the Chinese embassy in Brazil said in a message on Twitter announcing the gift.
Before the first vaccines rolled off assembly lines, Huawei seemed to be losing the 5G contest in Brazil, knocked to the sidelines by the Trump administration’s campaign against it. Latin America’s largest nation was only months away from holding an auction to create its 5G network, a sweeping upgrade that will make wireless connections faster and more accessible.
Huawei, along with two European competitors, Nokia and Ericsson, aspired to play a leading role in partnering with local telecommunications companies to build the infrastructure. But the Chinese company needed the green light from Brazilian regulators to take part.
The Trump administration moved aggressively to thwart it. During a visit to Brazil last November, Keith Krach, then the State Department’s top official for economic policy, called Huawei an industry pariah that needed to be locked out of 5G networks.
“The Chinese Communist Party cannot be trusted with our most sensitive data and intellectual property,” he said in a Nov. 11 speech in Brazil, during which he referred to Huawei as “the backbone of the CCP surveillance state.”
Mr. Krach argued that “free nations” needed to agree to coalesce around a “clean network” that excluded Huawei, because “our chain of security is only as strong as its weakest link.”
Weeks after the visit, Brazil appeared to be on board with Washington’s efforts to blacklist Huawei. In a statement issued after Mr. Krach’s meeting, Brazil’s foreign ministry said Brazil “supports the principles contained in the Clean Network proposal made by the United States.”
Eduardo Bolsonaro, a son of the president, who headed the foreign affairs committee in the lower house of Congress, said in a tweet that Brazil would back Washington’s push.
China had already faced scorn in some corners of Latin America early in the pandemic, as concerns that it had been careless in allowing the virus to slip beyond its borders took root. Beijing’s reputation took an additional hit in Peru, after exporting cheap, unreliable Covid tests that became an early misstep in the country’s efforts to rein in contagion.
But China found an opportunity to shift the narrative early this year, as its CoronaVac became the cheapest and most accessible inoculation for countries in the developing world.
With the pandemic under control in China, Sinovac, the maker of CoronaVac, began shipping millions of doses abroad, offering free samples to 53 countries and exporting it to 22 nations that placed orders.
As the first doses of CoronaVac were administered in Latin America, China took a swipe at wealthy nations that were doing little to guarantee prompt access to vaccines in poorer countries.
“Global distribution of vaccines must be fair and in particular, accessible and affordable to developing countries,” the foreign minister, Wang Yi, said in a speech late last month. “We hope that all countries that have the capability will join hands and make due contributions.”
In late February, as the first doses of China’s vaccines were being administered in Brazil, the country’s telecom regulatory agency announced rules for the 5G auction, which is scheduled to take place in July, that do not exclude Huawei.
The change in Brazil reflects how the campaign against Huawei driven by Mr. Trump has lost momentum since his defeat in the November election. Britain said it would not ban equipment made by Huawei from its new high-speed 5G wireless network. Germany has signaled a similar approach to Britain’s.
Thiago de Aragão, a Brasília-based political risk consultant who focuses on China’s relationships in Latin America, said two factors saved Huawei from a humiliating defeat in Brazil. The election of President Biden, who has harshly criticized Brazil’s environmental record, made the Brazilian government unenthusiastic about being in lock step with Washington, he said, and China’s ability to make or break the early phase of Brazil’s vaccination effort made the prospect of angering the Chinese by banning Huawei untenable.
“They were facing certain death by October and November and now they’re back in the game,” Mr. de Aragão said of Huawei.
The request for vaccines by the Brazilian communications minister, Mr. Faria, occurred as it became clear Beijing held the keys to accelerate or throttle the vaccination campaign in Brazil, where more than 270,000 people have died of Covid-19.
The only reason Brazil had a few million doses of CoronaVac on hand in early February was that one of Mr. Bolsonaro’s rivals, São Paulo Governor João Doria, had negotiated directly with the Chinese.
In an interview, Mr. Faria said there was no quid pro quo suggested in his request to Huawei for help with vaccines. In fact, he said, he also asked executives at competing telecommunications companies in Europe if they could help Brazil obtain shots.
“It wasn’t put on the table, vaccines versus 5G,” he said, describing the request for help with vaccines as appropriate.
In a statement, Huawei did not say it would provide vaccines directly but said the company could help with “communication in an open and transparent manner in a topic involving the two governments.”
China is also the dominant supplier of vaccines in Chile, which has mounted the most aggressive inoculation campaign in Latin America, and it is shipping millions of doses to Mexico, Peru, Colombia, Ecuador and Bolivia.
In a sign of China’s growing leverage, Paraguay, where Covid-19 cases are surging, has struggled to gain access to Chinese vaccines because it is among the few countries in the world that have diplomatic relations with Taiwan, which China considers part of its territory.
In an interview, Paraguay’s foreign minister, Euclides Acevedo, said his country is seeking to negotiate access to CoronaVac through intermediary countries. Then he made an extraordinary overture to China, which has spent years trying to get the last few countries that recognize Taiwan to switch their alliances.
“We would hope the relationship does not end at vaccines, but takes on another dimension in the economic and cultural spheres,” he said. “We must be open to every nation as we seek cooperation and to do so we must have a pragmatic vision.”