(AP) -- Stocks capped another wobbly day of trading on Wall Street with modest gains Friday, though the S&P 500 still ended with its biggest weekly loss in nearly two months.
The benchmark index rose 0.4% after falling 1.3% earlier in the day as investors weighed more grim data showing how badly the coronavirus pandemic is crippling the economy.
The government reported that U.S. retail sales sank a record 16.4% in April, the second steep decline in a row as store closures kept shoppers away. Then the Federal Reserve said that industrial production plunged a record 11.2% last month. Overseas, Germany's economy shrank in the first quarter, meaning that Europe's largest economy is in a recession.
Stocks initially fell in response to the dour economic data, then wavered between small gains and losses through the final minutes of trading. The erratic movements echoed much of the market's action this week and reflect how investors are wrestling between pessimism over the damage the outbreak is inflicting on the economy and cautious optimism that the fallout from the pandemic will begin easing as more U.S. states and countries around the world reopen their economies.
"Investors are really torn," said Chris Zaccarelli, chief investment officer for Independent Advisor Alliance. "There's one camp of thinking that it's always darkest before the dawn. And the other camp is thinking this is just the tip of the iceberg."
The S&P 500 rose 11.20 points to 2,863.70. It ended down 2.3% for the week, its worst showing since late March and its third weekly loss in the last four.
The Dow Jones Industrial Average gained 60.08 points, or 0.3%, to 23,685.42. The Nasdaq composite added 70.84 points, or 0.8%, to 9,014.56. Small-company stocks fared better than the rest of the market. The Russell 2000 index climbed 19.44 points, or 1.6%, to 1,256.99.
Bonds yields rose. The yield on the 10-year Treasury note, a benchmark for interest rates on many consumer loans, rose to 0.64% from 0.61% late Thursday.
Communications, health care and technology stocks accounted for much of the gains as investors continued to bet on internet providers, health insurers and other companies seen as being less affected by the stay-at-home orders that have hurt so many other types of businesses. Traders also bid up shares in cruise lines and some other companies whose shares have been badly beaten down since the outbreak. Royal Caribbean climbed 6.5% and Carnival rose 4.2%.
Chipmakers were among the biggest losers after the U.S. government moved to impose new restrictions on Chinese tech giant Huawei. The Commerce Department said Friday the restrictions, which impede Huawei's ability to use U.S. technology and software to design and manufacture its semiconductors abroad, aim to cut off the company's undermining of existing U.S. sanctions.
The U.S. government blacklisted the Chinese tech company a year ago, deeming it a national security risk. But there have been numerous loopholes that U.S. officials say the new restriction is meant to address. Lam Research was the biggest decliner in the S&P 500, losing 6.4%. Qualcomm fell 5.1%.
Energy stocks rose as crude oil prices climbed. Benchmark U.S. crude oil for June delivery rose $1.87, or 6.8%, to settle at $29.43 a barrel Friday. Brent crude oil for July delivery rose $1.37, or 4.4% to $32.50 a barrel.
Fears of a crushing recession due to the coronavirus sent the S&P 500 into a skid of more than 30% from its high in February. Hopes for a relatively quick rebound and unprecedented moves by the Federal Reserve and Congress to stem the economic pain fueled a historic rebound for stocks in April, with the S&P 500 recouping nearly all of its losses.
So far this month, however, stocks have been headed mostly lower. Investors are balancing cautious optimism of a recovery as economies around the world slowly ease the restrictions on people and businesses against worries that the moves could lead to another surge in coronavirus infections and more economic uncertainty.
Earlier this week, Federal Reserve Chair Jerome Powell warned the downturn could be lengthy, while the top infections diseases expert in the U.S. said that reopening the economy too quickly could backfire and lead to more deaths.
Wall Street is looking ahead to the fall and next year in hopes that the recession doesn't drag out, paving the way for corporate profits to bounce back. But much depends on how the reopening of businesses goes and the trajectory of the outbreak.
"Looking at states that have (begun) reopening to see what happens with the virus data, do you see an acceleration? That's going to be very important," said Tom Hainlin, national investment strategist at U.S. Bank Wealth Management.
While many companies have ceased to provide earnings forecasts for the rest of this year, citing uncertainty over the when the pandemic will be under control and how soon the economy will recover, investors may get some insights next week when Walmart, Home Depot, Best Buy, Target and other retailers report quarterly results.
Major stock indexes in Asia ended mixed Friday. Markets in Europe closed mostly higher despite a report showing that Germany, the continent's largest economy, fell into recession in the first quarter with a 2.2% quarter-on-quarter decline. That pullback echoed economic declines in France and Italy.