(AP) -- Stocks shook off an early stumble and scratched out small gains on Wall Street Monday, as the market's momentum slows following its best month in decades.
The S&P 500 added 0.4% and narrowly avoided what would have been its first three-day losing streak in nearly two months. The Dow eked out a 0.1% gain, while the Nasdaq rose 1.2%.
When U.S. trading opened, the market appeared set for a uniformly depressing day. The S&P 500 dove 1.2% almost immediately, with airlines sinking particularly sharply after famed investor Warren Buffett said he'd dumped all his shares in the four biggest U.S. carriers. A ramping up of tensions between the White House and China over the origins and handling of the coronavirus pandemic was also weighing on markets around the world.
But big tech stocks, whose momentum has been nearly unstoppable in recent years, continued to rally and helped the market trim its losses. Energy stocks also helped steady the market after the price of oil pulled a bit further from the record lows set late last month.
The S&P 500 rose 12.03 points to 2,842.74. The Dow Jones Industrial Average added 26.07 to 23,749.76, and the Nasdaq gained 105.77 to 8,710.71.
The market is "searching for direction at this point," said Sam Stovall, chief investment strategist at CFRA.
After plunging by just over a third from February into late March on worries about a coming, severe recession, the stock market has since more than halved its losses on hopes that infections are leveling off and that growth could resume later this year amid a gradually reopening economy.
The S&P 500 surged 12.7% in April for its best monthly performance in 33 years. The month has historically been one of the best of the year for U.S. stocks, while May has been more of a struggle.
"I wouldn't hold out a lot of hope for seasonal strength," Stovall said. "This is the six-month period in which the market tends to trace out the design on Charlie Brown's shirt."
Many professional investors have been skeptical of the market's huge rally given how much devastation is rolling through the economy. Uncertainty is extremely high about how long the recession will last after businesses shut down worldwide in hopes of slowing the spread of the virus. Even some of Wall Street's optimists said a pullback for the S&P 500 was overdue.
Strategists at Morgan Stanley called such a pullback, which could reach 10%, "a necessary pause that refreshes." While acknowledging the severe recession that everyone sees gripping the world, they say stocks can still resume their climb due largely to "seemingly unlimited central bank support, unprecedented fiscal stimulus" and a possible deceleration in the shocking numbers coming in on the economy.
Monday's biggest losses were concentrated in airlines, after Berkshire Hathaway disclosed that it sold all its stakes in American Airlines Group, Delta Air Lines, Southwest Airlines and United Airlines. Berkshire Hathaway's Buffett is one of the stock market's most famous bargain hunters, and investors around the world parse every clue he gives about investing. Over the weekend, he said he'd made a mistake in how he valued airlines.
All four of the airlines lost 5.1% or more on Monday.
Also potentially weighing on markets was Buffett saying that he's hanging onto his cash and hasn't made any big deals recently because he hasn't seen any on attractive terms.
Tech stocks in the S&P 500 rose 1.4%, though, and they make up roughly a quarter of the index by market value, which gives them particularly big sway over the market. Microsoft, the biggest company in the index, climbed 2.4%.
Energy stocks jumped 3.7% after a barrel of U.S. crude oil for delivery in June rose 61 cents to $20.39 per barrel. It's been generally climbing since dropping to $6.50 late last month, but it's still way below the roughly $60 level where it started the year amid worries about collapsing demand and swelling supplies.
Brent crude, the international standard, rose 76 cents to $27.20 per barrel.
Earlier in the day, markets in Asia and Europe fell to losses after tensions worsened between the world?s two biggest economies.
Criticized over his handling of the crisis, President Donald Trump has tried to shift the blame to China. Beijing has repeatedly pushed back on U.S. accusations that the outbreak was China's fault.
The antagonisms threaten the truce in a trade war between Washington and Beijing that was struck just before China began shutting much of its economy down in late January to fight the pandemic.
"We're still battling with the notions of how and when we'll bottom and how things will be different at the end of" the pandemic, said Keith Buchanan, senior portfolio manager at Globalt.
Reintroducing a tariff dispute just "adds another worrying point for the market," he said.
Stocks in Hong Kong dropped 4.2%, while South Korea's market lost 2.7%. In Europe, France's CAC 40 fell 4.2%, Germany's DAX lost 3.6% and Britain's FTSE 100 fell 0.2%.
Monday was the first opportunity for France, South Korea and other markets to catch up to the rest of the world, following their closures for holidays last week. Stock markets in Tokyo and Shanghai were among those closed for holidays on Monday.