The basal ganglia modulate somatosensory pain pathways but it is unclear whether a common circuit exists to mitigate hyperalgesia in pain states induced by peripheral nociceptive stimuli. As a key output nucleus of the basal ganglia, the substantia nigra pars reticulata (SNr) may be a candidate for this role. To test this possibility, we optogenetically modulated SNr GABAergic neurons and examined pain thresholds in freely behaving male mice in inflammatory and neuropathic pain states as well as comorbid depression in chronic pain. We observed that stimulation of either SNr GABAergic neurons or their projections to the subthalamic nucleus (STN) significantly alleviated nociceptive responses in all pain states on the contralateral side and comorbid depression in chronic pain, and that this analgesic effect was eliminated when SNr-STN GABAergic projection was blocked. However, SNr modulation did not affect baseline pain thresholds. We also found that SNr-STN GABAergic projection was attenuated in pain states, resulting in disinhibition of STN neurons. Thus, impairment of the SNr-STN GABAergic circuit may be a common pathophysiology for the maintenance of hyperalgesia in both inflammatory and neuropathic pain states and the comorbid depression in chronic pain; compensating this circuit has potential to effectively treat related pain conditions.