Thiamine monophosphatase (TMPase, also known as fluoride-resistant acid phosphatase) is a classic histochemical marker of small-diameter dorsal root ganglia neurons. The molecular identity of TMPase is currently unknown. We found that TMPase is identical to the transmembrane isoform of prostatic acid phosphatase (PAP), an enzyme with unknown molecular and physiological functions. We then found that PAP knockout mice have normal acute pain sensitivity but enhanced sensitivity in chronic inflammatory and neuropathic pain models. In gain-of-function studies, intraspinal injection of PAP protein has potent antinociceptive, antihyperalgesic, and antiallodynic effects that last longer than the opioid analgesic morphine. PAP suppresses pain by functioning as an ecto-5'-nucleotidase. Specifically, PAP dephosphorylates extracellular adenosine monophosphate (AMP) to adenosine and activates A1-adenosine receptors in dorsal spinal cord. Our studies reveal molecular and physiological functions for PAP in purine nucleotide metabolism and nociception and suggest a novel use for PAP in the treatment of chronic pain.