Perhaps it's no surprise to anyone who has had a splitting migraine after a miserable day, but doctors have solidified the link between stress and headaches.

Although headaches can be triggered by many factors, ranging from muscle strain to exposure to noxious gases, stress clearly plays a major role, according to a study released on Feb. 19 which will be presented at a neurology research meeting in April.

In the study, researchers followed more than 5,000 participants in Germany for two years and found that the greater the stress in a person's life, the more intense and frequent their headaches were. [Ouch: 10 Odd Causes of Headaches]

"Increasing stress resulted in increasing headache frequency for all headache subtypes," said study leader Dr. Sara Schramm, of the University of Duisburg-Essen in Germany. "[Study] participants with migraines experienced more stress than participants with tension-type headaches."

Conversely, participants who reported little stress in their lives had few, if any, headaches.

For the study, the researchers grouped headaches into four categories: tension headaches, which are the most common, and involve intense pressure or muscle ache anywhere from the neck to the forehead; migraines, which involve severe and sometimes pulsing pain, typically in one half of the head; a combination of the two; and unclassifiable headaches.

Participants were contacted four times yearly and were asked how many headaches they'd had in the previous three months. They also rated their stress level on a scale of zero to 100, following a well-established protocol for stress measurement.

Those with tension headaches rated their stress at an average of 52 out of 100. An increase of 10 points on the stress scale was associated with a 6.3 percent increase in the number of days per month when people had headaches.

For those with migraine headaches, the average stress level was 62 out of 100, and a 10-point increase on the stress scale was linked with a 4.3 percent increase in the number of headache days per month.

The study results imply that, while headache medicine can help mitigate the pain, reducing stress can prevent headaches from even happening, the researchers said.

"Our findings are important to support the tailoring of stress-management approaches in patients with different headache subtypes," Schramm told Live Science. “[These] results add weight to the concept that stress can be a factor contributing to the onset of headache disorders, that it accelerates the progression to chronic headache, exacerbates headache episodes, and that the headache experience itself can serve as a stressor."

So, chronic headache sufferers might consider reaching for the yoga mat before they go for the aspirin. The variety of stress-relieving activities likely outnumbers the types of painkillers on the pharmacy shelves.

Follow Christopher Wanjek @wanjek for daily tweets on health and science with a humorous edge. Wanjek is the author of "Food at Work" and "Bad Medicine." His column, Bad Medicine, appears regularly on Live Science.

Related on LiveScience and MNN:

This story was originally written for LiveScience and was republished with permission here. Copyright 2014 LiveScience, a TechMediaNetwork company.