(AP) -- Stocks shook off a downbeat start to close higher Monday, as big gains by technology and communications companies helped offset losses elsewhere on Wall Street.
The S&P 500 rose 0.8% after having been down 0.2% in the early going. The Dow Jones Industrial Average rose 0.3% and the Nasdaq composite added 1.9%.
Twitter surged 27.1% for the biggest gain in the S&P 500 after the company disclosed that Tesla's Elon Musk had taken a 9.2% stake in the social media platform. In recent weeks Musk has publicly questioned the company's commitment to free speech. The gains were a key factor in lifting the broader communications sector and keeping the S&P 500 in the green even as little less than half the companies in the index fell.
The market's latest moves follow three straight weekly gains by the S&P 500, even as investors grapple with uncertainties stemming from surging inflation, higher interest rates from the Federal Reserve and the economic fallout from the war in Ukraine.
The S&P 500 rose 36.78 points to 4,582.64, the Dow gained 103.61 points to 34,921.88, and the tech-heavy Nasdaq rose 271.05 points to 14,532.55.
Smaller company stocks also gained ground. The Russell 200 index rose 4.33 points, or 0.2%, to 2,095.44.
Apple and other big technology stocks did the heavy lifting Monday, offsetting losses elsewhere. Tech companies, with their pricey stock values, tend to have more weight in pushing the market up or down. Apple rose 2.4% and Microsoft gained 1.8%.
Retailers and other companies that rely on consumer spending also helped lift the market. Tesla rose 5.6%, Amazon added 2.9% and Home Depot closed 1.2% higher.
Investors continue to monitor the conflict in Ukraine, where Russia could face even stricter economic sanctions now that details are emerging of what appear to be deliberate killings of civilians.
The European Union's foreign policy chief, Josep Borrell, joined a growing chorus of international criticism of the alleged atrocities, saying the 27-country bloc "will advance, as a matter of urgency, work on further sanctions against Russia."
Russia's invasion of Ukraine has elevated concerns about rising inflation and the impact on global economic growth. Prices for everything from food to clothing had already been rising and the war has made for even more volatile energy prices.
The price of U.S. benchmark crude oil rose 4% and Brent crude, the international standard rose 3%. Prices are up roughly 40% globally, which has put pressure on costs for gasoline and other goods.
Bond yields mostly gained ground. The yield on the 10-year Treasury rose to 2.41% from 2.38% late Friday. The yield on the two-year Treasury dipped to 2.41% after having moved higher most earlier in the day.
The two-year yield has been hovering at times above the 10-year yield, which is a potentially ominous sign. Such a flip of the usual relationship between two- and 10-year yields has preceded many recessions in the past, though it hasn't been a perfect predictor. Some market watchers caution the signal may be less accurate this time, because of distortions in yields caused by extraordinary measures by the Federal Reserve and other central banks to keep interest rates low.
Bond yields have been climbing all year as Wall Street prepares higher interest rates. The Federal Reserve has already raised its key overnight rate once, the first such increase since 2018. The central bank is expected to continue raising rates throughout 2022 to help counter the impact from rising inflation.
The Fed is due to release minutes from its last meeting on Wednesday.
Markets in Europe closed higher. Asian markets also rose and Hong Kong's Hang Seng jumped 2.1% after regulators in Beijing said they plan to revise rules regarding access of overseas regulators to full audits of companies that have shares listed in overseas markets.