Major U.S. stocks wavered between small gains and losses in late-afternoon trading Friday, erasing some of the market’s gains from earlier in the day. Gains in health care and industrial companies outweighed losses in technology stocks and banks. Energy companies rose along with the price of U.S. crude oil.

KEEPING SCORE: The S&P 500 index fell 2 points to 2,930 at closing time. The Dow Jones Industrial Average gained 51 points, or 0.2 percent, to 26,708. The Nasdaq composite lost 41 points, or 0.5 percent, to 7,987. The Russell 2000 index of smaller companies gave up 4 points, or 0.3 percent, to 1,715. The Dow and S&P 500 each hit all-time highs Thursday.

TRADE TIGHTROPE: The trade dispute between the U.S. and China is set to escalate Monday. That’s’ when an additional 10 percent tax on $200 billion of Chinese imports kicks in. The tariffs will rise to 25 percent on Jan 1. Beijing has said it would retaliate by imposing tariffs of 5 or 10 percent on $60 billion of U.S. goods including coffee, honey and industrial chemicals.

Some U.S. companies are already bracing for the fallout from the latest round of tariffs. Chipmaker Micron Technology said Friday its profits would be hurt by the tariffs on Chinese imports that go into effect next week. Shares in the company slid 3.9 percent to $44.27.

Still, investors were taking the potential negative impact of the trade dispute in stride this week, taking comfort from the latest signs that the economy is on solid ground and driving the market higher.

THE QUOTE: “Finally the market has shrugged off all the trade war fears,” said Karyn Cavanaugh, senior markets strategist at Voya Investment Management. “The robustness of the economy just won’t be put down.”

TAKING FLIGHT: Several airlines notched gains, part of a broad pickup in industrial sector stocks. American Airlines Group climbed 3.8 percent to $43.47 after the company said it will raise fees for checked bags. The move came a day after Delta Air Lines announced its own plans to raise baggage fees. Delta shares added 2.8 percent to $59.77. Southwest Airlines rose 2 percent to $63.73.

IN GOOD HEALTH: Edwards Lifesciences led a rally in health care sector stocks. The company gained 1.6 percent to $153.90.

FEELING CHIPPER: Texas Instruments added 1.4 percent to $109.97 after the chipmaker raised its quarterly dividend and said it will buy back $12 billion in stock.

PRECISION DEAL: Mazor Robotics surged 10.2 percent to $58.15 after the surgical guidance system maker agreed to be bought by Medtronic for $1.54 billion.

UNAPPETIZING RESULTS: United Natural Foods slumped 10.9 percent to $30.16 after the food distributor reported disappointing earnings and sales.

ENERGY: Benchmark U.S. crude gained 0.7 percent to settle at $71.78 a barrel in New York. Brent crude, used to price international oils, added 0.1 percent to close at $78.80 a barrel in London.

The rise in crude oil prices sent many energy stocks higher. Marathon Petroleum rose 1.6 percent to $83.21.

Shares in Duke Energy slid 1.1 percent to $79.77 after floodwaters inundated lake a large lake near a retired coal-fired power plant, raising concerns of a potential breach.

BOND YIELDS: Bond prices were little changed. The yield on the 10-year Treasury held steady at 3.07 percent.

CURRENCY: The dollar rose to 112.52 yen from Thursday’s 112.48 yen. The euro edged down to $1.1747 from $1.1776. The British pound weakened to $1.3078 from $1.3268 after British Prime Minister Theresa May said talks over exiting the European Union are at an impasse.

METALS: Gold fell 0.8 percent to $1,201.30 an ounce. Silver gained 0.4 percent to $14.36 an ounce. Copper surged 4.3 percent to $2.86 a pound.

MARKETS OVERSEAS: In Europe, Germany’s DAX gained 0.8 percent, while France’s CAC 40 rose 0.8 percent. London’s FTSE 100 index climbed 1.7 percent. Major indexes in Asia finished mostly higher. Hong Kong’s Hang Seng gained 1.7 percent and Tokyo’s Nikkei 225 rose 0.8 percent. Seoul’s Kospi added 0.7 percent. Sydney’s S&P-ASX 200 picked up 0.4 percent.

© The Associated Press. All rights reserved.