By Joe Wallace and Paul Vigna

U.S. stock rose Tuesday, stabilizing after a bout of volatility that had tested investors' confidence in the market's monthslong rebound.

The Dow Jones Industrial Average rose 140.48 points, or 0.5%, to 27288.18, breaking a three-session losing streak.

The S&P 500 and Nasdaq Composite both snapped four-session losing streaks. The broad index rose 34.51 points, or 1.1%, to 3315.57, and the technology-heavy Nasdaq rose 184.84 points, or 1.7%, to 10963.64.

After a blistering summer rally, stocks have cooled this month. All three indexes are down more than 6% from their peaks in early September.

"We went too far, too fast," said Lindsey Bell, the chief investment strategist at Ally Invest. "I don't think any of this should be a surprise."

The turbulence entered a new phase Monday, when shares in sectors that are highly sensitive to economic growth, such as banks, materials and industrials, suffered the biggest declines. Tech stocks, whose swings had weighed on markets in recent weeks, advanced.

The consumer discretionary, communication services and tech sectors led Tuesday's rebound.

Investors are contending with a clutch of risks that are intertwined. New cases of coronavirus are increasing in Europe, and reported new cases increased sharply in the U.S. on Monday, to 52,000. That was the highest single-day increase since Aug. 14, according to Johns Hopkins University.

A second wave of infections would hamper the economic recovery, which may be damaged further if Congress doesn't pass another relief package to provide additional unemployment benefits.

"It's key to the U.S. economy that the unemployment benefits continue to be delivered to the consumers, the households," said Sophie Chardon, cross-asset strategist at Lombard Odier. "Consumer confidence is still very fragile."

But the odds of a new relief package went down after Supreme Court Justice Ruth Bader Ginsburg died Friday. The political fight over the court could also have an impact on the presidential election, and money managers must also think about the possibility of a protracted period of uncertainty following the election.

"The volatility will continue for a little while longer," said Andrew Sheets, chief cross-asset strategist at Morgan Stanley. Ultimately, the turbulence is likely to be a blip in a long-running bull market, he said.

In Washington, Federal Reserve Chairman Jerome Powell and Treasury Secretary Steven Mnuchin testified on Capitol Hill about the government's pandemic response.

In prepared remarks published Monday, Mr. Powell suggested Congress would need to spend more to shore up struggling parts of the economy. "The path forward will depend on keeping the virus under control, and on policy actions taken at all levels of government," he said.

For now, stock traders are paying close attention to technical levels, Ms. Bell said. On Monday, the market's slide halted as the S&P 500 came close to correction territory, or a 10% loss from a recent high. She expects traders will keep a close eye on that and other technical indicators, like the 100- and 200-day moving averages.

"This has been a technically driven market through the entire rebound," she said. "I expect that to continue."

Shares of major technology companies were among the biggest winners Tuesday. Amazon.com jumped $168.52, or 5.7%, to $3,128.99. Facebook rose $6.60, or 2.7%, to $254.75. Apple gained $1.73, or 1.6%, to $111.81.

The swirl of current events is creating short-term chaos in the market, but Tuesday's rebound shows it isn't scaring off all investors. For long-term investors, in fact, it is time to buy, said Kenny Polcari, managing partner at Kace Capital Advisors.

"It's good to shake the trees," he said. "You see who the weak ones are, who are not really committed, like the Robinhood traders," he said.

What investors should be focused on, he said, is the long-term fundamentals. Until those change, there is no reason to be overly concerned.

"Apple's down 20% in the last few weeks? For me that's a screaming opportunity," he said.

The yield on the 10-year Treasury note ticked down to 0.663%, from 0.670% Monday. The WSJ Dollar Index, which tracks the U.S. currency against a basket of others, edged up 0.4%, a day after it notched its biggest one-day advance in more than a month.

Overseas, the Stoxx Europe 600 gained 0.2%, clawing back some ground after suffering its biggest one-sessions fall since mid-June.

Asian markets fell following Monday's selloff in the U.S. The Shanghai Composite Index fell 1.3%, while South Korea's Kospi shed 2.4%.

Commodity markets were mixed. U.S. crude futures rose 0.7% to $39.60 a barrel. Gold futures fell 0.1% to $1,898.60 a troy ounce.

Write to Joe Wallace at Joe.Wallace@wsj.com and Paul Vigna at paul.vigna@wsj.com