Wall Street stepped back from the cliff on Tuesday after two days of Brexit panic. 

The Friday shock of the United Kingdom's vote to exit the European Union sent global markets into a spiral that day and Monday, eliminating $3 trillion in market capitalization. 

Such a steep descent over just two sessions presented traders with opportunity to pick up heavily oversold equities on Tuesday. The S&P 500 was up 1.78%, the Dow Jones Industrial Average rose 1.57%, and the Nasdaq climbed 2.12%.

Benchmark indexes remained in the red for the year, though, and not all of the Brexit-losses were eliminated by the end of the session. Since Friday, the S&P 500 has fallen nearly 4%. 

The pro-exit result Friday from the U.K. referendum sent European markets into a selloff and the pound plummeting, touching its lowest level in 30 years Monday. The move has far-reaching political and economic consequences as new trade deals and regulations begin to get drawn up over the next two years. Both Standard & Poor's and Fitch lowered their ratings on U.K. debt Monday.

"After a strong two-day reaction to Britain's vote to leave the European Union, a range of markets are staging price corrections, with equities surging and the U.S. dollar declining from the levels reached on Monday," says Citi's Timothy Evans.

Talk of further accommodation from global central banks also appeared to boost investor appetite Tuesday. Hopes have begun to rise that the Bank of England and the Bank of Japan could offer further stimulus in the wake of the uncertainty in Europe. Since Friday, the chances of a U.S. rate hike from the Federal Reserve this year have become unlikely, according to CME Group fed funds futures.

Crude oil recovered on Tuesday after also participating in the two-day selloff. The commodity had been under pressure as the greenback soared, deterring foreign purchases of U.S.-produced oil. West Texas Intermediate crude oil was up 3.3% to $47.85 a barrel on Tuesday.

"Crude futures are heading higher ... as prices attempt to join global equity markets in the effort to recover from two days of Brexit-induced selling," Robbie Fraser, commodity analyst at Schneider Electric, wrote in a note. "While currency fluctuations are always an important factor for crude prices, the relationship has been particularly significant of late, as a historic plunge for the pound and euro propped up the value of the U.S. dollar."

The energy sector was leading market gains. Major oilers Exxon Mobil (XOM - Get Report) , Royal Dutch Shell (RDS.A - Get Report) , Chevron (CVX - Get Report) , PetroChina (PTR - Get Report) , Total (TOT - Get Report) and BP (BP - Get Report) were higher, while the Energy Select Sector SPDR ETF (XLE - Get Report) added 2.4%.

First-quarter U.S. gross domestic product was raised to 1.1% growth in the third and final reading on Tuesday morning. First-quarter GDP has previously been estimated at 0.8%. Consumer spending was reduced, while exports were revised to show a slight gain over a previously estimated decline.

The U.S. economy suffered an economic slowdown at the beginning of the year as cautious consumers opted to save rather than spend, a strong U.S. dollar and weaker overseas demand hampered U.S. manufacturing, and energy prices continued to weigh on the sector. 

Home prices climbed in April, though at a slightly slower pace than March, according to the S&P Case-Shiller Home Price Index. Prices rose 5%, more than the past 12 months ending April, just shy of 5.1% growth seen in March. Tight inventory and strong demand have driven home prices in the past year.

Consumer confidence in the U.S. improved in June at a far-faster pace than analysts expected. The Conference Board's index climbed to a reading of 98 this month, up from a revised 92.6 in May and well above expectations for a reading of 93.3. The improvement is a surprise, conflicting with a separate survey from the University of Michigan that showed a deterioration in sentiment.