The Sanders campaign said Friday that Vermont Sen. Bernie Sanders had a heart attack earlier this week, disclosing more details about the health scare that has temporarily sidelined his presidential bid.

The 2020 presidential candidate left the hospital Friday afternoon. The update on Mr. Sanders’s health comes two days after the campaign said he had two stents put in a coronary artery after suffering chest pain during a campaign event Tuesday night in Nevada.

“His...