Chronic pain is a substantial health burden and options for treating chronic pain remain minimally effective. Ketogenic diets are emerging as well-tolerated, effective therapeutic strategies in preclinical models of chronic pain, especially diabetic neuropathy. We tested whether a ketogenic diet is antinociceptive through ketone oxidation and related activation of ATP-gated potassium (KATP) channels in mice. We demonstrate that consumption of a ketogenic diet for one week reduced evoked nocifensive behaviors (licking, biting, lifting) following intraplantar injection of different noxious stimuli (methylglyoxal, cinnamaldehyde, capsaicin, or Yoda1) in mice. A ketogenic diet also decreased the expression of p-ERK, an indicator of neuronal activation in the spinal cord, following peripheral administration of these stimuli. Using a genetic mouse model with deficient ketone oxidation in peripheral sensory neurons, we demonstrate that protection against methylglyoxal-induced nociception by a ketogenic diet partially depends on ketone oxidation by peripheral neurons. Injection of tolbutamide, a KATP channel antagonist, prevented ketogenic diet-mediated antinociception following intraplantar capsaicin injection. Tolbutamide also restored the expression of spinal activation markers in ketogenic diet-fed, capsaicin-injected mice. Moreover, activation of KATP channels with the KATP channel agonist diazoxide reduced pain-like behaviors in capsaicin-injected, chow-fed mice, similar to the effects observed with a ketogenic diet. Diazoxide also reduced the number of p-ERK+ cells in capsaicin-injected mice. These data support a mechanism that includes neuronal ketone oxidation and activation of KATP channels to provide ketogenic diet-related analgesia. This study also identifies KATP channels as a new target to mimic the antinociceptive effects of a ketogenic diet.