Tension-type headache (TTH) and migraine are both common types of headaches. Despite distinct symptoms, TTH and migraine are highly comorbid and exhibit many clinical similarities. This study enrolled consecutive patients with TTH and age- and sex-matched patients with migraine and healthy controls to investigate whether TTH and migraine are similar in brain excitability change assessed by magnetoencephalography. Patients with TTH were excluded if they reported any headache features or associated symptoms of migraine. In response to paired-pulse electrical stimulations, the gating responses obtained from the contralateral primary somatosensory cortex differed between groups. The first response, which reflected the preactivation excitability, was smaller in the migraine group (29.54 ± 2.31 pAm) compared with the TTH group (79.76 ± 8.36, P < 0.001) and controls (59.95 ± 4.26, P = 0.006). The gating ratio (ie, the ratio of the second vs first response strength) was 0.76 ± 0.03 in controls, 0.88 ± 0.03 in the migraine group, 0.93 ± 0.03 in the TTH group, with a significant increase in TTH (P = 0.003 vs controls) suggesting central disinhibition. The area under the receiver operating characteristic curve of the first response strength in differentiating between TTH and migraine was 0.85 ± 0.44, indicating excellent discrimination. In conclusion, TTH and migraine are different clinical entities in view of somatosensory cortex excitability. The preactivation excitability assessed through somatosensory gating is a potential marker for differentiating between TTH and migraine.