NEW YORK (AP) -- U.S. stocks went on another dizzying ride Friday and worked their way back from an early-morning plunge to send the Standard & Poor's 500 index to its first gain in four days. It was just the latest swing in a frenetic week for markets around the world as investors recalibrated --- again and again --- how worried to be about a possible trade war and a more aggressive Federal Reserve.
When U.S. markets opened for trading, the S&P 500 lost as much as 1.1 percent to join a worldwide sell-off after President Donald Trump doubled down on "trade war" talk. He took to Twitter to defend his promise from Thursday to impose stiff tariffs on imports of steel and aluminum, saying that the United States is losing on trade with virtually every country and that "trade wars are good" and "easy to win."
Investors had a different impression. Markets tumbled from Asia to Europe on fears that escalating retaliation between countries could choke off trade and the global economy. The president of the European Union's governing body suggested possible tariffs on blue jeans and motorcycles.
The S&P 500 trimmed its loss as the day went on and was bouncing between gains and losses by the early afternoon. It accelerated in the last half hour of trading and ended at 2,691.25, up 13.58 points, or 0.5 percent. The Dow Jones industrial average fell 70.92, or 0.3 percent, to 24,538.06, and the Nasdaq composite rose 77.31, or 1.1 percent, to 7,257.87.
Stocks pared their losses as investors questioned how far Trump will end up going, said Brent Schutte, chief investment strategist at Northwestern Mutual Wealth Management.
"I view nearly every one of Trump's actions through a negotiation lens," he said. "This was an anchor, an opening bid. ... I think the market senses some of that, and I would imagine that we will see some horse trading going on with what ultimately happens with these tariffs."
The S&P 500 still ended the week with a loss of 2 percent, its third decline that severe in the last five weeks. Last year, the worst weekly loss was just 1.4 percent.
If a trade war does indeed break out, it could threaten a key reason investors were optimistic about stocks coming into 2018: The global economy is finally strengthening in sync, which should lead to higher corporate profits.
Big U.S. companies are heavily reliant on global trade, and companies in the S&P 500 got 43 percent of their sales from outside the United States in 2016, according to S&P Dow Jones Indices. That means Apple and other big U.S. companies are dependent on customers not only in Peoria but also Paris and Peru.
Stocks of smaller U.S. companies, which tend to do more of their business at home, did much better than the rest of the market. The Russell 2000 index of small-cap stocks rose 25.78, or 1.7 percent, to 1,533.17.
The trade worries are piling onto a market that was already nervous. Concerns about the possibility of higher inflation and interest rates have rocked markets since the S&P 500 set its latest record high in late January.
Inflation has been low in the years following the Great Recession, but if it jumps higher, it could force the Federal Reserve to raise short-term rates more sharply than investors are expecting. That could easily upset markets, which had been enjoying a remarkably smooth ride last year.
The Fed's chairman, Jerome Powell, jolted markets on Tuesday, when he said that he's feeling more optimistic about the U.S. economy. Some investors took that as a signal that the Fed may get more aggressive, which sent stocks down and Treasury yields higher. Later in the week, though, Powell may have calmed some of the fears when he said that he does not see inflation in wages "at a point of acceleration."
Such a dance is typical when central banks are raising interest rates and "tightening" financial conditions, rather than easing, said Schutte.
"When central banks ease, the goal is shock and awe, or to use a football analogy, to throw the deep ball," he said. "When they hike, it's three yards and a cloud of dust. They want to advance the ball gradually."
The yield on the 10-year Treasury rose to 2.86 percent from 2.81 percent late Thursday.
The biggest loss in the S&P 500 came from Foot Locker, which plunged after it said sales trends were weaker last quarter than analysts expected. Shares dropped $5.84, or 12.7 percent, to $40.04.
McDonald's stock dropped on fears that its value menu isn't drumming up much in sales, and an analyst at RBC Capital Markets cut his expectations for the chain's sales in the United States. Its shares dropped $7.43, or 4.8 percent, to $148.27.
The losses follow up sharp drops in markets overseas. In Asia, Japan's Nikkei 225 plunged 2.5 percent, the Hang Seng in Hong Kong fell 1.5 percent and South Korea's Kospi dropped 1 percent.
In Europe, France's CAC 40 lost 2.4 percent, and Germany's DAX fell 2.3 percent. The FTSE 100 in London gave up 1.5 percent.
In the commodities markets, benchmark U.S. crude rose 26 cents to settle at $61.25 per barrel. Brent crude, the international standard, rose 54 cents to $64.37 a barrel.
Gold rose $18.20 to settle at $1,323.40 per ounce. Gold usually rises when investors are feeling more nervous about inflation and the economy. Silver climbed 19 cents to $16.47 per ounce, and copper added 2 cents to $3.12 per pound.
Natural gas was virtually flat at $2.70 per 1,000 cubic feet, heating oil slipped a cent to $1.88 per gallon and wholesale gasoline gained a penny to $1.90 per gallon.
The dollar fell to 105.54 Japanese yen from 106.24 yen late Thursday. The euro rose to $1.2331 from $1.2255, and the British pound rose to $1.3790 from $1.3768.