To the best of my knowledge, Esophageal spasms are uncommon. Often, symptoms that may suggest an esophageal spasm are the result of another
condition such as gastroesophageal reflux disease (GERD) or achalasia, a problem with the nervous system in which the muscles of the esophagus and the lower esophageal sphincter (LES) don't work properly. Anxiety or panic attacks can also cause similar symptoms.
Your doctor can often find out the cause of esophageal spasm from your medical history by asking you a series of questions. These include questions about what foods or liquids trigger symptoms, where it feels like food gets stuck, other symptoms or conditions you may have, and whether you are taking medicines for them.
The diagnosis can be confirmed with tests, including esophagus tests (such as esophageal manometry) or a barium swallow. Esophageal manometry uses a small tube attached to instruments (transducers) that measure pressure. A barium swallow is done using X-rays.