U.S. stock indexes turned mostly lower in afternoon trading Friday, placing the market on course to end the week with sharp loss. Stocks briefly rallied after President Donald Trump expressed optimism that the U.S. and China will reach a deal to resolve their costly trade dispute, but the gains quickly faded. The remarks came as representatives of both countries have resumed talks.

Losses in large retailers and technology companies outweighed gains by health care companies, energy stocks and utilities.

Energy companies rose along with the rice of U.S. crude oil.

KEEPING SCORE: The S&P 500 index slipped 1 point, or 0.1 percent, to 2,728 as of 1:40 p.m. Eastern Time. The Dow Jones Industrial Average gained 58 points, or 0.2 percent, to 25,348. The Nasdaq composite lost 42 points, or 0.6 percent, to 7,216. The Russell 2000 index of smaller companies gave up 4 points, or 0.3 percent, to $1,519. The stock indexes were on course end the week with a hefty loss.

US-CHINA TRADE: Investors appeared to draw some encouragement from Trump's remarks at the White House Friday. Speaking about the lingering trade dispute, the president said he hoped the U.S. could make a deal with China.

"I think a deal will be made," Trump said. "We'll find out very soon."

Stocks snapped higher after the remarks were reported, with the Dow briefly jumping as much as 220 points, before pulling back to about where they were beforehand.

The Trump administration has imposed a 10 percent tariff on $200 billion of Chinese goods over complaints Beijing steals or pressures foreign companies to hand over technology as the price of market access. That tariff is set to rise to 25 percent in January. Another $50 billion of Chinese goods already is subject to 25 percent duties. Beijing has responded with penalty duties on $110 billion of American goods.

Washington and Beijing resumed talks over their spiraling trade dispute this week ahead of a meeting between President Xi Jinping and Trump, China's Commerce Ministry said Thursday.

CRYPTO FALLOUT: Shares in technology stocks skidded, led by Nvidia. The chipmaker plunged 19.3 percent to $163.28 after saying it had a large number of unsold chips because of a big drop in mining of cryptocurrencies.

SHIELDED? Troubled California power provider PG&E surged 37.2 percent to $24.34 after the president of the utility's state regulator said it was essential for a power company to have the financial strength to operate safely. The remark late Thursday by California Public Utilities Commission President Michael Picker appeared to reassure investors that regulators might limit the potential financial hit that PG&E faces from the devastating wildfire in Northern California, which started Nov. 8 and has killed at least 56 people.

RETAIL RATTLED: Nordstrom cratered 14.4 percent to $50.51 after the department store issued weak guidance for the full year. That disappointing outlook overshadowed the company's third-quarter results, which topped Wall Street's estimates.

UNDERCOOKED: Williams-Sonoma tumbled 12.6 percent to $52.92 after the cookware seller said products were delayed because of shipping congestion out of China ahead of U.S. tariffs.

FEELING GOOD: Health care stocks were among the biggest gainers. Bristol-Myers Squibb gained 1.3 percent to $53.96.

IN STRIDE: Shoe Carnival climbed 3.4 percent to $38.36 after the company reported earnings that were much higher than analysts were forecasting.

ENERGY: Oil prices headed higher, adding to gains from a two-day winning streak. Benchmark U.S. crude oil rose 0.5 percent to $56.73 a barrel in New York. Brent crude, used to price international oils, gained 0.6 percent to $66.96 a barrel in London. Despite the latest uptick, U.S. crude oil is still down about 13.3 percent for the month.

The pickup in oil prices helped lift energy stocks. Helmerich & Payne rose 2 percent to $61.24.

BOND YIELDS: Bond prices rose. The 10-year Treasury fell to 3.08 percent from 3.11 percent late Thursday.

CURRENCIES: The dollar fell to 112.76 yen from 113.58 yen on Thursday. The euro strengthened to $1.1417 from $1.1348. The pound rose to $1.2833 from $1.2791.

OVERSEAS: Major European stock indexes were subdued as trade tensions and political risks surrounding Britain's exit from the European Union kept investors cautious. Germany's DAX lost 0.1 percent and France's CAC slid 0.2 percent. Britain's FTSE 100 gave up 0.3 percent. In Asia, Japan's Nikkei 225 index lost 0.6 percent while the Hang Seng in Hong Kong added 0.3 percent. South Korea's Kospi rose 0.2 percent.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.