Although religious belief is often claimed to help with physical ailments including pain, it is unclear what psychological and neural mechanisms underlie the influence of religious belief on pain. By analogy to other top-down processes of pain modulation we hypothesized that religious belief helps believers reinterpret the emotional significance of pain, leading to emotional detachment from it. Recent findings on emotion regulation support a role for the right ventrolateral prefrontal cortex, a region also important for driving top-down pain inhibitory circuits. Using functional magnetic resonance imaging in practicing Catholics and avowed atheists and agnostics during painful stimulation, here we show the existence of a context-dependent form of analgesia that was triggered by the presentation of an image with a religious content but not by the presentation of a non-religious image. As confirmed by behavioral data, contemplation of the religious image eneabled the religious group to detach themselves from the experience of pain. Critically, this context-dependent modulation of pain specifically engaged the right VLPFC, whereas group-specific preferential liking of one of the pictures was associated with activation in the ventral midbrain. We suggest that religious belief might provide a framework that allows individuals to engage known pain-regulatory brain processes.