The influence of affect and attention on sensory and affective pain as well as on somatosensory evoked potentials in response to painful and nonpainful electrical stimuli was investigated in a single experimental design. Affect was induced by pictures from the International Affective Picture System; attention was manipulated by asking participants to focus attention either on the pictures or on the electrical stimuli. Sensory and affective pain ratings were generally lower during exposure to positive compared to negative and neutral pictures. Attention modulated only sensory pain ratings with lower ratings with an attention focus on pictures than with an attention focus on sensory pain. The N150 was modulated by picture valence, the P260 by picture arousal. Furthermore, the P260 was modulated by attention with highest amplitudes with an attention focus on the stimulus intensity. This study provides neurophysiological evidence that attention and affect have distinct effects on pain processing.