Wall Street capped a milestone-setting week Friday with a mixed finish for the major U.S. stock indexes and the second all-time high in two days for the Dow Jones Industrial Average.
An afternoon sell-off erased modest gains for the S&P 500 that had the benchmark index on track to eke out its own record high for much of the day.
Losses for technology companies and retailers, two of the market's hottest sectors this year, offset gains in energy and industrial stocks.
"When you have a big up week like we've had, we're at all-time highs, for people to take a little bit of risk off the table going into the weekend isn't a big surprise," said Randy Frederick, vice president of trading and derivatives at Charles Schwab.
The S&P 500 index dropped 1.08 points, or 0.04 percent, to 2,929.67, just under its latest all-time high set a day earlier. The Dow gained 86.52 points, or 0.3 percent, to 26,743.50, thanks largely to gains in Boeing and McDonald's.
The Nasdaq composite lost 41.28 points, or 0.5 percent, to 7,986.96. The Russell 2000 index of smaller companies gave up 7.87 points, or 0.5 percent, to 1,712.32.
The Dow and S&P 500 each ended the week with their 10th weekly gain in the past 12 weeks.
Coming off Thursday's record-setting rally, trading was listless for much of Friday. A couple of factors may have contributed to the market's late-afternoon pullback.
Friday was "quadruple witching" day, when options and futures contracts expire, which often results in heavy trading.
Also, next Monday the S&P 500 is changing the lineup of the 11 company sectors that make up the benchmark index. Technology giants Google and Facebook will join Netflix and 15 other companies in a new communications services sector.
The change forces exchange-traded funds, or ETFs, and other funds that track the S&P 500's sectors to make trades to reflect the new alignment of the index.
"There's probably some selling going on in ETFs and mutual funds right now and also probably on Monday," Frederick said.
Micron Technology was among the biggest decliners in the technology sector. The chipmaker said Friday its profits would be hurt by new tariffs on Chinese imports that go into effect next week. Shares in the company slid 2.9 percent to $44.74.
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.
Still, investors have been taking the potential negative impact of the trade dispute in stride this week, drawing comfort from the latest signs that the economy is on solid ground and driving the market higher.
"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."
Other sectors fared better Friday. Several airlines notched gains, part of a broad pickup in industrial sector stocks. American Airlines Group climbed 4.1 percent to $43.60 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.5 percent to $59.61. Southwest Airlines rose 2 percent to $63.77.
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.
Benchmark U.S. crude gained 0.7 percent to settle at $70.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. Cimarex Energy rose 2.1 percent to $92.34.
Shares in Duke Energy slid 1 percent to $79.82 after floodwaters inundated lake a large lake near a retired coal-fired power plant, raising concerns of a potential breach.
Bond prices were little changed. The yield on the 10-year Treasury held steady at 3.07 percent.
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.
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.
In other energy trading, heating oil gave up 0.1 percent to $2.23 a gallon, wholesale gasoline added 0.1 percent to $2.02 a gallon and natural gas was little changed at $2.98 per 1,000 cubic feet.
Major stock indexes in Europe posted solid gains Friday. Germany's DAX added 0.8 percent, while France's CAC 40 rose 0.8 percent. London's FTSE 100 index climbed 1.7 percent.
In Asia, markets closed 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.