U.S. stocks rose for the first time in three sessions Tuesday, recovering some of their brutal losses seen in the aftermath of the U.K.’s vote to quit the European Union.

The Dow Jones Industrial Average, DJIA, -0.87% which over the past two sessions lost 900 points, jumped 269.48 points, or 1.6%, to 17,409.72. The broader S&P 500 index SPX, -1.11% added 35.55 points, or 1.8% to 2,036.09, with all 10 main sectors finishing higher. Energy, financials and technology sectors lead the gains, rising more than 2%.

The Nasdaq Composite Index COMP, -1.07% added 97.42 points, or 2.1%, to 4,691.87.

The gains come after a brutal, two-day rout in global equities that resulted in months of gains washed away following Britain’s referendum to leave the EU, known as Brexit. Rattled investors feared that Brexit would destabilize the European trading bloc.

However, investors appeared to turn cautiously optimistic Tuesday.

“The selloff after Brexit is very similar to a selloff in 2011 when the U.S. credit rating was downgraded. We expect markets to recover just as they did five years ago,” said Doug Cote, chief market strategist at Voya Investment Management.

Cote warned this isn't the end of volatility, however.

“Politics and markets are more intertwined in this crisis than any other crisis and it’s hard to predict which way politics would go,” Cote said.

Read:Wall Street’s ‘fear gauge’ on track for sharpest drop in 3 years post-Brexit

Despite the change in momentum for equities Tuesday, investors were cautious about the staying power of the early gains given the severity and swiftness of the recent slide, which pushed the Dow and the S&P 500 below their 200-day moving average—a key technical threshold that signals long-term downtrends and uptrends.

“The concern would be that this is just a ‘dead cat bounce’ and traders simply see this as another chance to sell. However, for now the outlook is a little more positive,” said Richard Perry, analyst at Hantec Markets, in a note.

Brexit poses a challenge to Japan's recovery

A “dead cat bounce” refers to a brief rebound in stocks after a substantial fall, usually followed by a continuation of the selloff.

Economic news: Market reaction to economic reports was largely muted. The U.S. economy’s annual growth rate in the first quarter was raised again to 1.1% in line with expectations. However, the pace of growth was still one of the weakest performances in the past several years.

U.S. house prices rose 1.1% in April, according to a closely watched price gauge released Tuesday. Meanwhile, U.S. consumer confidence took a step higher in June — although the survey was taken before Britain’s vote to leave the European Union.

Movers and shakers: Shares of energy companies jumped after a rebound in oil prices.

Southwestern Energy Company SWN, +1.66% surged 12%, Marathon Petrolem Corp MPC, +0.49% and Marathon Oil Corp MRO, +2.99% rose 8.4% and 8.2%, respectively.

Shares of biotech firm Endo International PLC ENDP, +0.61% soared 18% after the U.S. Patent and Trademark Office approved a patent on Vasostrict, its treatment for patients suffering from vasodilatory shock.

Meanwhile, bank shares rose sharply. Citigroup Inc. C, -1.47% shares jumped 5.1%, JPMorgan Chase & Co climbed 3.3%.

Shares of Tesla Motors Inc. TSLA, +4.42% climbed 1.6%. SolarCity Corp. SCTY, +7.36% late Monday said it would form a two-person committee of independent board members to evaluate the electric-car maker’s buyout offer for the solar panel company. Shares of SolarCity rose 5%.

Regulus Therapeutics Inc. RGLS, -3.97% lost half of its value, diving 49% to $2.54, after the biopharmaceutical company late Monday said the Food and Drug Administration has placed its investigational new drug for the treatment of chronic hepatitis C virus infection on clinical hold.

LendingClub Corp. LC, -3.32% rallied 7.2% after the fintech company said it’d eliminate almost 200 jobs.

Shares of ReachLocal Inc. US:RLOC soared 170% to $4.56 after Gannett Co. GCI, +1.27% late Monday said it is buying the digital marketing company for $4.60 a share.

Other markets: European stock markets climbed across the board, with the Stoxx Europe 600 index SXXP, -0.66% gaining 2.4%.

The pound GBPUSD, +0.10% , which slumped to a 31-year low after the Brexit vote, regained some ground to trade at $1.336 on Tuesday.

Asia markets also rebounded after getting slammed in the wake of last week’s Brexit vote.