The trade dispute between the U.S. and China escalated Friday, but Wall Street focused on a solid jobs report instead.
After a wobbly start, U.S. stocks mounted a broad rally, shaking off two consecutive weekly losses.
Growing jitters in recent weeks over a stepped-up trading dispute between the world's two largest economies had weighed on the markets well ahead of Friday, when Beijing and Washington launched dueling tariffs on billions in goods.
"The markets had already sold off the prior two weeks," said Dan Heckman, national investment consultant at U.S. Bank Wealth Management. "The market probably had built that expectation in already and today we're seeing a nice rebound."
A solid pickup in hiring by U.S. employers last month also helped keep investors in a buying mood.
The S&P 500 index rose 23.21 points, or 0.8 percent, to 2,759.82. The Dow Jones Industrial Average gained 99.74 points, or 0.4 percent, to 24,456.48. The Nasdaq composite added 101.96 points, or 1.3 percent, to 7,688.39. The Russell 2000 index of smaller-company stocks picked up 14.57 points, or 0.9 percent, to 1,694.05.
The U.S. put a 25 percent tax on $34 billion worth of Chinese imports Friday. China retaliated with taxes on an equal amount of U.S. products, including soybeans, pork and electric cars, calling the move the start of the "biggest trade war in economic history."
Though the first exchange of tariffs is unlikely to inflict much economic harm on either nation, the damage could soon escalate. President Donald Trump, who has claimed that winning a trade war would be easy, has said that he's prepared to drastically raise tariffs on more Chinese imports. Mounting tariffs could raise costs across the board for consumers and businesses, slowing growth and investment and hurting companies that rely on imported parts to make their goods.
Despite the market's gains Friday, much damage has already been inflicted on stocks that would stand to lose in a protracted trade battle with China. American companies that do a lot of business there have seen steep drops in their stock prices in the past few weeks.
Aircraft maker Boeing, which relies on China for 12.3 percent of its sales, according to FactSet, has seen its stock fall 9.9 percent over the last month as the trade tensions with China worsened.
Heavy equipment maker Caterpillar, for whom China is also its second-biggest market after the U.S., is off 13.5 percent over the same time. Liquor maker Brown-Forman, whose products include Jack Daniels, is off 15 percent since late May. Whiskey, along with soybeans, pork and cheese, is among the products Chinese is slapping retaliatory tariffs on.
As the prospect of Chinese tariffs on soybeans grew in recent weeks, the price of soybeans has fallen sharply. Soybean futures have fallen from $10.42 a bushel in late May to $8.95 Friday, a drop of 14 percent.
That hurts U.S. soybean farmers and could also have an impact on makers of farm equipment, such as Deere & Co. Deere's stock has fallen 11.7 percent over the last month. Last year China bought 30 percent of the soybeans produced in the U.S.
"The market is counting on this to subside," said Erik Davidson, chief investment officer at Wells Fargo Private Bank. "If they get an indication that this will continue to escalate, that will cause some problems."
Investors also welcomed new data Friday from the government showing that U.S. employers kept up a brisk pace of hiring last month, without having to hike wages much. Markets have been watching to see if tight labor market conditions would force wages higher, a sign of inflation.
The Labor Department said that U.S. employers added 213,000 jobs in June. Average hourly pay rose just 2.7 percent from a year earlier, which means that after adjusting for inflation wages remain nearly flat.
Health care stocks posted the biggest gains, led by Biogen. The drugmaker's stock soared 19.6 percent to $357.48 on encouraging results from an Alzheimer's therapy.
Technology companies also notched solid gains. Advanced Micro Devices rose 5.6 percent to $16.36.
U.S. crude oil prices reversed an early slide. Benchmark U.S. crude gained 86 cents, or 1.2 percent, to settle at $73.80 per barrel in New York. Brent crude, used to price international oils, fell 28 cents to close at $77.11 per barrel in London.
Bond prices rose. The yield on the 10-year Treasury fell to 2.82 percent from 2.83 percent late Thursday.
The dollar fell to 110.45 yen from 110.68 yen on Thursday. The euro strengthened to $1.1745 from $1.1680.
Gold dropped $3 to $1,255.80 an ounce. Silver slipped 3 cents to $16.07 an ounce. Copper was little changed at $2.82 a pound.
In other energy futures trading, heating oil slipped 1 cent to $2.17 a gallon. Wholesale gasoline lost 2 cents to $2.11 a gallon. Natural gas rose 2 cents to $2.86 per 1,000 cubic feet.
Major indexes in Europe finished higher. Germany's DAX added 0.3 percent, while France's CAC 40 rose 0.2 percent. Britain's FTSE 100 gained 0.2 percent.
Asian markets erased earlier losses to finish mostly higher as the uncertainty ended over whether Washington would escalate tensions with Beijing. Hong Kong's Hang Seng index gained 0.5 percent, while South Korea's Kospi added 0.7 percent. Tokyo's Nikkei 225 jumped 1.1 percent after a four-day losing streak. Australia's S&P-ASX 200 rose 0.9 percent.