NEW YORK, (Reuters) - Wall Street fell in a day of heavy trading on Wednesday with the S&P 500 posting its biggest percentage drop since late June as investors turned risk-averse on disappointing earnings and escalating global tariff worries.

Chinese technology company Tencent Holdings Ltd 0700.HK reported its first profit decline in almost 13 years, putting pressure on the U.S. tech sector. Technology stocks were the biggest drag on the S&P 500 and the Nasdaq, with the S&P 500 technology index .SPLRCT down 1.1 percent.

Retail shares fell as Macy's Inc M.N stock tumbled 15.9 percent after margin fears spooked investors, overshadowing its stronger-than-expected sales and earnings.

“There was a lot of optimism heading into retail earnings,” said JJ Kinahan, chief market strategist at TD Ameritrade in Chicago. Macy’s results have “taken an edge off that optimism.”

Second-quarter U.S. earnings have mostly been stronger than expected, with 79.1 percent beating analyst expectations, according to Thomson Reuters I/B/E/S. Results are in for 460 of S&P 500 companies.

The trade fracas heated up as Turkish President Tayyip Erdogan doubled tariffs on some U.S. imports, and China lodged a complaint with the World Trade Organization against American trade policies.

The tariff-sensitive industrial sector .SPLRCI slipped 0.5 percent, with Caterpillar Inc CAT.N and Boeing Co BA.N weighing on the Dow.

“A combination of fears of contagion from Turkey and a possibility of a China slowdown has upset markets worldwide,” Kinahan added.

The S&P 500 energy index .SPNY dropped 3.5 percent as a fall in crude prices CLc1 was exacerbated by an unexpected surge in U.S. stockpiles. The energy index suffered its biggest percentage loss since Feb. 5.

Metals prices fell, dragging down the materials sector .SPLRCM, which ended down 1.6 percent. The S&P 1500 metals and mining index .SPCOMMTM was down 4.8 percent.

Adding to the day's bearish tone for metals and for stocks was the U.S. dollar. The dollar index .DXY briefly touched a 13-month high before ending the day essentially flat.

The Dow Jones Industrial Average .DJI fell 137.51 points, or 0.54 percent, to 25,162.41, the S&P 500 .SPX lost 21.59 points, or 0.76 percent, to 2,818.37 and the Nasdaq Composite .IXIC dropped 96.78 points, or 1.23 percent, to 7,774.12.

Losses were somewhat offset by gains in defensive sectors, including real estate .SPLRCR and utilities .SPLRCU.

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

Tesla Inc TSLA.O stock fell 2.6 percent as the Securities and Exchange Commission sent the company subpoenas regarding Chief Executive Elon Musk's plan to go private, according to Fox Business Network.

Among gainers, Canada-based Canopy Growth CGC.N soared by 30.4 percent following Corona beer maker Constellation Brands' STZ.N announcement that it was upping its stake in the cannabis producer.

Chipotle Mexican Grill Inc CMG.N stock rose by 6.6 percent after Morgan Stanley upgraded the burrito chain to "overweight" from "equal weight."

In economic news, retail sales rose more than expected in July, while farm productivity rose at its fastest rate in over three years.

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

The S&P 500 posted 13 new 52-week highs and 12 new lows; the Nasdaq Composite recorded 63 new highs and 149 new lows.

Volume on U.S. exchanges was 7.86 billion shares, compared with the 6.53 billion average over the last 20 trading days.