Cognitive impairment is commonly associated with the pain experience. This impairment represents a major obstacle to daily activities and rehabilitation, especially in the chronic pain population. Here we review clinical and preclinical studies that have investigated pain-related alterations in cognition. These include impaired attentional, executive and general cognitive functioning. We describe the anatomical, neurochemical and molecular substrates common to both cognitive processing and supraspinal pain processing, and present the evidence for their involvement in pain-related cognitive impairment. We also examine the added complexity of cognitive impairment caused by analgesic medications and how this can further impact on morbidity in chronic pain patients. The need for a better understanding of the mechanisms of both pain-induced and treatment-related cognitive impairment is highlighted. Further research in this area will aid our understanding of patient symptoms and their underlying pathophysiology, ultimately leading to increased provision of guided therapy.