Sen. Bernie Sanders had a medical procedure to insert stents to open an artery blockage, his campaign said, after the Democratic presidential candidate experienced chest pain during a campaign event Tuesday night.

The campaign said Mr. Sanders (I., Vt.) will cancel his events and appearances until further notice. The campaign said Mr. Sanders, 78 years old, “is conversing and in good spirits.”

Mr. Sanders later tweeted to thank well-wishers and said he was “feeling good.” He also said his experience underscored the need for his Medicare for All health-care proposal.

Mike Casca, a spokesman for the campaign, said Mr. Sanders didn’t lose consciousness during the episode. He originally said the senator didn’t have a heart attack, but later said more tests would be run to determine that diagnosis.

The health setback sidelines Mr. Sanders as he competes for the nomination in the top rung of Democratic hopefuls. Mr. Sanders said Tuesday that he had raised $25.3 million for his campaign during the past three months.