Stocks slashed losses to close well off the lows of the day on Friday as investor worries about a U.S.-China trade war decreased.

The Dow Jones industrial average closed 84.83 points lower at 25,090.48, with Caterpillar as the worst-performing stock in the index. The fell 0.1 percent at 2,779.42 — after briefly turning positive — with energy lagging. The Nasdaq composite slipped 0.1 percent to 7,746.38.

"The market has done a good job of whistling past the graveyard when it comes to trade policy," said Art Hogan, chief market strategist at B. Riley FBR. "The market has come back to think we'll probably get some sort of negotiation done."

Earlier on Friday, the Dow fell as much as 280.93 points, while the S&P 500 and Nasdaq both dropped 0.7 percent after the Trump administration said it will impose a 25 percent charge on up to $50 billion in Chinese goods, raising fears of a trade war looming between the U.S. and China.

In a statement Friday, President Donald Trump said the measures would affect Chinese goods "that contain industrially significant technologies," without specifying those products. He added that the action comes "in light of China's theft of intellectual property and technology and its other unfair trade practices."

Trump also said the U.S. would impose more tariffs on Chinese goods if China retaliates with duties of its own on American products.

"This is an issue that still causes fear and uncertainty in the market, but ... the tone of the White House can change very quickly," said Craig Birk, executive vice president of portfolio management at Personal Capital. "This is a long game so it doesn't make sense to overreact one way or the other."