Having a cup of coffee in the morning could help prevent physical pain triggered by spending hours sitting at a computer, a new study reveals.

The study involved 48 participants, 22 with chronic neck or shoulder pain and 26 healthy pain-free people, who had to sit in front of a computer for 90-minutes and do intensive screen-based work meant to mimic office work without pauses.

Norwegian researchers said that the tasks were known to cause pain in the shoulders, neck, forearms and wrists.

Researchers from Norway's National Institute of Occupational Health and Oslo University Hospital wanted to compare how people with chronic pain and those who were pain-free tolerated the tasks, and only as a matter of convenience allowed people to drink coffee before taking the test "to avoid unpleasant effects of caffeine deprivation, e.g. decreased vigor and alertness, sleepiness, and fatigue," they reported.

While the study was not intended to examine the effects of caffeine, researchers found that 19 of the participants who had drank coffee, whether they had chronic pain or not, developed less pain over the course of the 90 minutes compared to those who didn't drink coffee.

Participants who drank coffee also rated their pain as less intense than the other 29 study participants.

On average participants who drank coffee rated their pain intensity to be 41 on a 100 point scale compared to participants who abstained from coffee who rated their pain intensity to be 55, and results from the study, published in the journal BMC Research Notes, revealed that similar gaps were found for all other pain sites.

Past research suggests that caffeine stimulates certain receptors in the body that are responsible for blocking the effects of pain, and the stimulant is often added to pain-killing medications like aspirin and paracetamol, because it is thought to enhance their pain-relieving qualities.

Coffee has also been shown to protect against liver cancer, Alzheimer's disease and even strokes.

Researchers concluded that while both coffee drinkers and non-drinkers experienced pain in their shoulders, neck, arms and wrists during the task, coffee drinkers reported significantly lower levels of discomfort.

"The results revealed a significantly lower increase in pain development for the subjects who had consumed coffee approximately one and a half hours before the task, compared to those who abstained," researchers wrote in the study.

"Several other studies have found attenuated pain during exercise after caffeine administration," they noted. "But we are not aware of any that have examined the effect of coffee on naturally-occurring pain during work of very low-level muscle activity, as during computer work."