Causes of esophageal spasm.
Esophageal spasms are painful contractions within the muscular tube connecting your mouth and stomach (esophagus). Esophageal spasms can feel like sudden, severe chest pain that lasts from a few minutes to hours.
It's not clear what causes esophageal spasms.
However, they appear to be related to abnormal functioning of nerves that control the muscles you use when you swallow.
A healthy esophagus normally moves food into your stomach through a series of coordinated muscle contractions. Esophageal spasms make it difficult for the muscles in the walls of your lower esophagus to coordinate in order to move food to your stomach.
There are no known risk factors for esophageal spasms.
Source:
https://www.mayoclinic.org/diseases-conditions/esophageal-spasms/symptoms-
causes/syc-20372250