Background: The involuntary capture of attention by pain may, to some extent, be controlled by psychological variables. In this paper, we investigated the effect of attentional set (i.e., the collection of task-related features that a person is monitoring in order to successfully pursue a goal) on pain. Methods: Two experiments are reported in which the task relevance of the modality and spatial location of a target stimulus was manipulated. In both experiments, somatosensory and auditory stimuli were presented on each trial. In experiment 1, 29 participants were cued on each trial to localize either a somatosensory or an auditory target. In experiment 2, 37 participants were cued on each trial to identify either a somatosensory or an auditory target at a particular location. Results: In experiment 1, self-reported pain intensity and unpleasantness were reduced when participants had to localize the auditory target. The location of the painful stimulus relative to the location of the auditory target did not affect pain. In experiment 2, again, pain intensity and unpleasantness ratings were reduced when participants identified the auditory target. Now, the location of the painful stimulus relative to the location of the auditory target moderated the effect. Pain intensity was less when the painful stimulus was at a different location than the auditory target. Conclusions: Results are discussed in terms of the attentional set hypothesis, and we argue that the effectiveness of distraction tasks depends on the degree to which the task-relevant features of the distraction task are distinct from pain-related features.