(AP) -- Stocks overcame a late-afternoon burst of selling and closed higher Tuesday, as gains in big technology companies outweighed losses in banks and elsewhere in the market.
The S&P 500 rose 0.5% after being up 1.1% earlier. It's the second straight sizable gains for the benchmark index following its worst week since June.
High-flying technology stocks, which have been driving the market higher throughout the pandemic, abruptly lost altitude earlier this month amid worries that their prices had simply climbed too high, even after taking into account their tremendous growth.
But the past two days has marked a reversal of that trend, with shares in technology companies and others that play a key role in online access and commerce climbing again. Microsoft rose 1.6% Tuesday, while Amazon gained 1.7% and Zoom Video climbed 1.8%.
A key reason tech stocks are climbing again is that investors' expectations that the companies' profits will boom as even more of daily life shifts online haven't changed.
"The things that are doing well or are beneficiaries or are working in this environment, for good reason, are the things that are going up," said Tom Martin, senior portfolio manager with Globalt Investments. "That isn't going to change until we get a notable change in one of the things that are uncertain: The virus itself and the effect that's having on the economy, and whether we get anything new on the fiscal stimulus front."
The S&P 500 rose 17.66 points to 3,401.20. The Dow Jones Industrial Average inched up 2.27 points, or less than 0.1%, to 27,995.60. The index swung between a gain of 237 points and loss of 61. The Nasdaq, which is heavily weighted with tech stocks, climbed 133.67 points, or 1.2%, to 11,190.32.
Stocks of smaller companies eked out a tiny gain. The Russell 2000 index of small-caps picked up 1.18 points, or 0.1%, to 1,538.15.
Because tech companies have grown so massive, their movements alone can dictate the market's performance more than ever. Tech stocks as a group account for nearly 28% of the S&P 500, and they're up 3.1% this week after slumping more than 4% in each of the prior two weeks.
Analysts expect more volatility for stocks in the months ahead as the market navigates uncertainty over the outcome of the election, pessimism that Democrats and Republicans in Washington will be able to reach a deal to send more aid to unemployed workers and an economy still struggling amid the pandemic.
Investors weighed a batch of mixed global economic data Tuesday.
Stocks in Europe and much of Asia ticked higher following reports showing retail sales in China were higher last month than a year earlier for the first such growth this year, after the pandemic pancaked the world's second-largest economy. In Europe's largest economy, a reading on German economic confidence rose more than expected.
In the United States, a report showed that industrial production also strengthened last month. But the growth wasn't as strong as economists were expecting. Other reports showed that manufacturing in New York State is expanding more than economists expected, as are import and export prices.
Treasury yields were relatively steady. The yield on the 10-year Treasury was at 0.67%, unchanged from late Monday. The 30-year yield ticked up to 1.44% from 1.41%.
Shorter-term rates remain pinned at lower levels on expectations that the Federal Reserve will keep its benchmark rate at nearly zero for some time to help the economy recover. The central bank is beginning its latest meeting on interest-rate policy Tuesday, and it will announce its decision on Wednesday. Economists say it could change some of the language around its existing pledge to buy bonds to support markets, but they expect no major news.
On the losing side was Carnival, which dropped 10.8%, making it the biggest decliner in the S&P 500. The cruise ship operator said it may sell up to $1 billion in stock to raise cash, and it reported a preliminary $2.9 billion loss for its latest quarter. More encouragingly, it also said its advance bookings for the second half of 2021 are similar to where booking positions were in 2018 for the second half of 2019, before the coronavirus pummeled the industry.
Financial stocks were also laggards. JPMorgan Chase fell 3.1%, losing an earlier modest gain. It trimmed its forecast for this year's net interest income, which measures how much profit it makes from interest payments for loans and other products after subtracting the interest it pays out on deposits.
In European stock markets, Germany's DAX returned 0.2%, and the French CAC 40 rose 0.3%. The FTSE 100 in London climbed 1.3%. Markets in Asia ended mostly higher.