Stocks closed out a solid week on Wall Street Friday with a late-afternoon rebound after worries that President Donald Trump would reignite a costly trade war with China faded.

The president’s moves to withdraw funding from the World Health Organization, end Hong Kong’s special trade status and suspend visas of Chinese graduate students suspected of conducting research on behalf of their government fell short of any actions that might be perceived by investors as market negative.

The benchmark S&P 500 index rose 0.5%, recovering from a 1% slide, after Trump outlined several actions in response to a move by China to exert more control over Hong Kong but steered clear of upending a trade pact struck with Beijing earlier this year. The S&P 500 ended the month 4.5% higher, its second monthly gain in a row.

All told, the S&P 500 rose 14.58 points to 3,044.31. The index ended the week with a 3% gain. The Dow Jones Industrial Average fell 17.53 points, or 0.1%, to 25,383.11. The Nasdaq composite, which is heavily weighted with technology stocks, gained 120.88 points, or 1.3%, to 9,489.87. The Russell 2000 index of small company stocks gave up 6.64 points, or 0.5%, to 1,394.04.

Stocks have now recouped most of their losses after the initial economic fallout from the coronavirus pandemic knocked the market into a breathtaking skid in February and March, though the S&P 500 is still down 10% from its all-time high in February.

The world’s two largest economies agreed to a Phase 1 trade deal in January after more than a year of talks and billions of dollars in tariffs imposed on each other’s imports. Worries that the Trump administration would pull out of the deal with the world’s second-largest economy weighed on the market for much of the day, until the president’s mid-afternoon statement.

“Much ado about nothing,” Sam Stovall, chief investment strategist at CFRA, said of the remarks. “The immediate concern, meaning the cessation of the Phase 1 (trade) accord, did not end up being put on the table, much to traders’ relief.”

Technology and health care stocks accounted for much of the market’s gains. That helped offset losses in banks, industrial companies and elsewhere. Bond yields fell and gold prices rose, signs that investors remain cautious. Oil recovered from an early slide.

On Thursday, China’s National People’s Congress approved a national security law aimed at suppressing secessionist and subversive activity in Hong Kong, overriding any potential opposition by local lawmakers.

In his remarks, Trump blasted China, saying Hong Kong is no longer “sufficiently autonomous” to warrant the preferred status that the U.S. had been giving the former British colony when it comes to export controls, extradition treaties and travel.

“Basically, he’s going to treat Hong Kong the way he treats China," Stovall said.

Trump also said the U.S. would cut ties with the World Health Organization, saying it had failed to adequately respond to the coronavirus because China has “total control” over the global organization.

The move by China to get a tighter grip on Hong Kong could undermine the city’s status as a major center for trade and finance. Hong Kong’s Hang Seng index finished 0.7% lower Friday.

Washington and Beijing have been trading harsh rhetoric recently on everything from Hong Kong to the response to the coronavirus outbreak. That stoked worries that the renewed tensions could lead to another punishing round of escalating tariffs between the two countries, which would only further damage a global economy punished by a severe recession due to the pandemic.

The U.S. stock market plunged 34% from late February through late March but has rebounded quickly since then after the Federal Reserve and Congress pledged unprecedented amounts of aid for the economy. Recently, investors have favored stocks that would benefit the most from a reopening economy.

Governments around the country and around the world are slowly lifting restrictions meant to corral the outbreak. That has many investors hoping the worst of the recession has already passed, or will soon. However, concerns remain that the relaxing of stay-at-home mandates and the reopening of businesses could lead to another surge in infections, potentially extending how long it will take for the economy to recover.

“We’re in an incredibly fragile economy right now, and things are just getting back,” said J.J. Kinahan, chief market strategist at TD Ameritrade. “You need as much momentum as you can that encourages people to go out and spend money. Anything that upsets that fragile sort of enterprise has the opportunity to really set the stock market and the total economy off course.”

Earlier trading

Banks and industrial stocks had the biggest losses in the early going, while technology stocks continued to gain ground. The tech sector has far outpaced the rest of the market over the last year.

Markets fell Friday in Europe and Asia as the latest tensions spooked investors.

Benchmarks slipped in Paris, Frankfurt and Tokyo, while U.S. futures were down slightly ahead of a news conference about China by President Donald Trump later in the day.

U.S. and Chinese officials have been trading harsh rhetoric recently on everything from Hong Kong to the response to the coronavirus outbreak. One fear is that further friction could lead to another punishing round of escalating tariffs between the two countries that would hit the global economy when it’s already in a severe recession due to the coronavirus pandemic.

“The world awaits Trump’s news conference tonight and the market is reacting,” Chris Weston of Pepperstone said in a commentary.

China’s National People’s Congress on Thursday approved a national security law aimed at suppressing secessionist and subversive activity in Hong Kong, overriding any potential opposition by local lawmakers.

U.S. Secretary of State Mike Pompeo has said the law means Washington may no longer treat the former British colony, already reeling from anti-government protests and the pandemic, as autonomous from Beijing. That could undermine the city's status as a major center for trade and finance.

Meanwhile, a barrel of U.S. crude oil for delivery in July lost 88 cents to $32.83 per barrel in electronic trading on the New York Mercantile Exchange. It rose 90 cents to settle at $33.71 on Thursday. Brent crude, the international standard, gave up 85 cents to $35.18 per barrel. It rose 55 cents to $35.29 per barrel in London.

Annual inflation in the eurozone fell to just 0.1% in May, from 0.3% in April, reflecting both a slide in oil prices and weak demand for many goods outside of food.

Weak economic data from Japan also cast a pall, as the government reported that industrial production fell more than 9% in April from the month before, while retail sales dropped nearly 10%, month-on-month. That was the biggest fall since a sales tax hike in 1997.

Germany's DAX lost 0.9% to 11,675 and the CAC 40 in France slipped 0.6% to 4,743. Britain's FTSE 100 gave up 1% to 6,155.

French carmaker Renault said it would shed 15,000 jobs over three years and reduce its capacity, just after ally Nissan announced plant closures in Europe and Asia.

Hong Kong’s Hang Seng index dropped 0.7% to 22,961.47, while Japan’s Nikkei 225 index fell 0.2% to 21,877.89. Australia’s S&P/ASX 200 skidded 1.6% to 5,755.70.

The Kospi in South Korea added 0.1% to 2,029.60, while the Shanghai edged 0.2% higher to 2,852.35.

The yield on the 10-year Treasury fell to 0.67% from 0.70% late Thursday. It tends to reflect sentiment about the economy’s strength and inflation.

The dollar bought 107.16 Japanese yen, down from 107.64 yen late Thursday. The euro rose to $1.1139 from $1.1073.