Stocks soared in frenetic trading Tuesday, wiping out much of the losses they suffered just a day earlier in their biggest selloff since the financial crisis.

The market opened sharply higher, with the Dow Jones Industrial Average soaring nearly 1,000 points within the first few minutes of the opening bell. Stocks then erased the entirety of their gains before midday, only to charge higher again in the final hours of trading.

To...