Pain demands attention, yet pain can be reduced by focusing attention elsewhere. The neural processes involved in this robust psychophysical phenomenon, attentional analgesia, are still being defined. Our previous fMRI study linked activity in the brainstem triad of locus coeruleus (LC), rostral ventromedial medulla (RVM) and periaqueductal grey (PAG) with attentional analgesia. Here we identify and model the functional interactions between these regions and the cortex in healthy human subjects (n = 57), who received painful thermal stimuli whilst simultaneously performing a visual attention task. RVM activity encoded pain intensity while contralateral LC activity correlated with attentional analgesia. Psycho-Physiological Interaction analysis and Dynamic Causal Modelling identified two parallel paths between forebrain and brainstem. These connections are modulated by attentional demand: a bidirectional anterior cingulate cortex (ACC) – right-LC loop, and a top-down influence of task on ACC-PAG-RVM. By recruiting discrete brainstem circuits, the ACC is able to modulate nociceptive input to reduce pain in situations of conflicting attentional demand.