NEW YORK (Reuters) - U.S. stocks ended slightly lower on Friday as escalating trade anxieties driven by U.S. President Donald Trump’s latest tariff threats against China offset a string of robust earnings led by Microsoft.

The Dow Jones Industrial Average posted its third consecutive weekly gain, while the S&P 500 also rose for a third straight week after eking out a gain for the period.

Shares of Microsoft Corp MSFT.O hit a record high and ended the session up 1.8 percent on the heels of a strong second-quarter earnings beat. The company narrowed the race with Apple Inc AAPL.O and Amazon.com AMZN.O in the race to be worth $1 trillion in market value.

Microsoft’s advance provided the biggest support to the S&P 500 and the Nasdaq.

Trump said he was ready to impose tariffs on all $500 billion of Chinese imports, the latest salvo in a series of protectionist moves that have prompted retaliatory measures from U.S. trading partners around the world.

“I think there’s a divided line on the Street,” said Robert Pavlik, chief investment strategist at SlateStone Wealth LLC in New York. “One side believes that (the trade dispute) is only going to lead to a global recession, where the other side believes that the president is trying to get the other side to negotiate.”

Trump also repeated his criticism of planned interest rate hikes by the Federal Reserve, writing in a Twitter post that tightening U.S. monetary policy would diminish any U.S. trade advantage.

FILE PHOTO: Traders work on the floor of the New York Stock Exchange (NYSE) in New York, U.S., July 16, 2018. REUTERS/Brendan McDermid

Long-dated U.S. government bond yields rose on worries that the president’s comments would encourage Fed Chairman Jerome Powell to slow the pace of rate hikes by the U.S. central bank, which could increase inflationary pressure.

“The president can’t control interest rates,” Pavlik said. “He’s not a king. So I think the Street’s reaction to that is a major overreaction.”

As the second-quarter reporting season picks up steam, analyst forecasts have grown rosier. Earnings for S&P 500 companies are now estimated to have grown 22.0 percent in the quarter, compared with the 20.7 percent seen on July 1, according to Thomson Reuters I/B/E/S.

So far, 87 companies of the S&P 500 have posted results, of which 83.9 percent have beat consensus estimates.

The Dow Jones Industrial Average .DJI fell 6.38 points, or 0.03 percent, to 25,058.12, the S&P 500 .SPX lost 2.66 points, or 0.09 percent, to 2,801.83 and the Nasdaq Composite .IXIC dropped 5.10 points, or 0.07 percent, to 7,820.20.

Diversified manufacturer Honeywell International Inc's HON.N stock rose 3.8 percent after its earnings beat expectations and the company raised its profit forecast.

General Electric Co GE.N dropped 4.4 percent, the biggest drag on the S&P 500, after the conglomerate reported a smaller-than-expected drop in quarterly profit but trimmed its cash flow target.

Declining issues outnumbered advancing ones on the NYSE by a 1.12-to-1 ratio; on the Nasdaq, a 1.11-to-1 ratio favored decliners.

The S&P 500 posted 21 new 52-week highs and two new lows; the Nasdaq Composite recorded 109 new highs and 38 new lows.

Volume on U.S. exchanges was 6.00 billion shares, compared with the 6.42 billion-share average for the full session over the last 20 trading days.