A coffee a day keeps the suffering away, say researchers.

Want to increase your pain tolerance? Drink a cup of joe.

A new study in the journal Psychopharmacology has unearthed a link between caffeine consumption and the ability to withstand pain. In the study, adult men and women spent seven days logging their daily intake of all caffeine sources, be it coffee, tea, energy drinks, soda, or chocolate. The average amount for the study was 170 milligrams per day, or the amount found in two cups of coffee.

At the conclusion of the journaling period, the study subjects participated in a laboratory experiment in which they were exposed to increasing amounts of heat or pressure on the forearm or back. Subjects reported when the sensation first became uncomfortable, then again when it became too much to bear.

Their discovery? The more caffeine a person consumed in their daily diet, the greater their ability to withstand pain. This was true across all variables, including sex, race, and “pain catastrophizing,” or a tendency to describe pain in more exaggerated terms than the average person. The study also found this caffeine-pain tolerance link to be unaffected by the ingestion of other substances that may influence pain receptors, such as alcohol or tobacco.

“Increasing amounts of caffeine consumed as part of the daily diet may be sufficient to alter the nociceptive processing of pain signals in ways that significantly decrease sensitivity to painful stimuli,” says the research team from the University of Alabama, led by psychology researcher Demario Overstreet. They credit this to caffeine’s role in inhibiting activity in the peripheral and central nervous systems, which has an analgesic effect.

Though this isn’t a recommendation to start downing energy drinks by the case, it does help to justify a second (or third) cup of coffee during a particularly tough training block. In addition to keeping fatigue at bay, that caffeine jolt might just help you suffer better.