stock market
Traders work on the floor of the New York Stock Exchange Feb. 12, 2016. Getty Images

Wall Street bounced back Tuesday, recouping some recent losses, as investors sought cheap assets after a two-day equities rout sparked by Britain's decision to leave the European Union.

U.S. indexes joined stock markets around the world in the rebound after global equity markets had shed $3 trillion in value in the two days following Britain's shock vote, according to the S&P and Dow Jones indices. Investors also pointed to solid U.S. economic data as helping to stabilize stocks.

Financials and tech stocks, hit hard in the wake of the referendum, were among the top gaining sectors on Tuesday.

"People are starting to say maybe this is going to take longer than they thought and maybe the impacts on the U.S. market won’t be nearly as great as feared," said Rick Meckler, president of LibertyView Capital Management in Jersey City, New Jersey. "So I think you’ve seen a bit of bargain-hunting."

The Dow Jones Industrial Average rose 268.87 points, or 1.57 percent, to 17,409.11, the S&P 500 gained 35.52 points, or 1.78 percent, to 2,036.06 and the Nasdaq Composite added 97.42 points, or 2.12 percent, to 4,691.87.

All 10 S&P sectors finished higher. Energy shares gained 2.6 percent, leading all groups, supported by higher oil prices.

Major U.S. indexes had posted their worst two-day decline in 10 months following the British referendum.

Investors are still bracing for volatility in the coming weeks amid uncertainty about how Britain will pursue its EU exit, with some pointing to more possible downside. The S&P 500 was within 17 points of its May 2015 record high last Thursday.

Still, the CBOE Volatility Index, the favored gauge of investor anxiety, fell about 21 percent to trade close to where it was before the Brexit vote. It was its largest one-day percentage decline since August 2011.

Data on Tuesday showed U.S. economic growth slowed in the first quarter, but not as sharply as previously estimated. A report from the Conference Board showed consumer confidence increased to an eight-month high in June.

The data "reminded people that the U.S. economy is still in very good shape and sort of refocused everybody on the bigger picture, and let’s step back from the edge with regard to Brexit," said John Traynor, chief investment officer of People’s United Wealth Management in Bridgeport, Connecticut.

Gilead Sciences shares gained 5.2 percent after the large biotechnology company won U.S. approval for a hepatitis C medicine.

Endo International shares surged 18.3 percent, the top performer on the S&P 500, as the drugmaker announced a new patent.

More than 8.2 billion shares changed hands in U.S. exchanges, above the roughly 7.5 billion average over the past 20 sessions.

Advancing issues outnumbered declining ones on the NYSE by 2,644 to 440, for a 6.01-to-1 ratio on the upside; on the Nasdaq, 2,302 issues rose and 580 fell for a 3.97-to-1 ratio favoring advancers. The S&P 500 posted 16 new 52-week highs and 2 new lows; the Nasdaq recorded 22 new highs and 50 new lows.