We recorded deep pain and surface electromyographic (EMG) responses to stress in 22 migraineurs during headache-free periods, 18 patients with tension-type headache (TTH), and 44 healthy controls. Sixty minutes of cognitive stress was followed by 30 min relaxation. EMG and pain (visual analogue scale) in the trapezius, neck (splenius), temporalis and frontalis areas were recorded. TTH patients had higher pain responses in temporalis and frontalis (with similar trends for trapezius and splenius) and more potentiation of pain during the test than controls. Migraine patients developed more pain in the splenius and temporalis than controls. Muscle pain responses were more regional (more pain in the neck and trapezius compared with the temporalis and frontalis) in migraine than in TTH patients. TTH patients had delayed pain recovery in all muscle regions compared with controls, while migraine patients had delayed pain recovery in a more restricted area (trapezius and temporalis). EMG responses were not different from controls in headache patients, and EMG responses did not correlate with pain responses. TTH patients had delayed EMG recovery in the trapezius compared with controls and migraine patients. These results support the concept that (probably central) sensitization of pain pathways and the motor system is important in TTH. Less pronounced and more regional (either peripheral or central) trigeminocervical sensitization seems to be important in migraine. Surface-detectable muscular activation does not seem to be causal for pain during cognitive stress either in migraine or in TTH.