FTY720 (fingolimod), an FDA-approved drug for treatment of multiple sclerosis, has beneficial effects in the CNS that are not yet well understood, independent of its effects on immune cell trafficking. We show that FTY720 enters the nucleus, where it is phosphorylated by sphingosine kinase 2 (SphK2), and that nuclear FTY720-P binds and inhibits class I histone deacetylases (HDACs), enhancing specific histone acetylations. FTY720 is also phosphorylated in mice and accumulates in the brain, including the hippocampus, inhibits HDACs and enhances histone acetylation and gene expression programs associated with memory and learning, and rescues memory deficits independently of its immunosuppressive actions. Sphk2(-/-) mice have lower levels of hippocampal sphingosine-1-phosphate, an endogenous HDAC inhibitor, and reduced histone acetylation, and display deficits in spatial memory and impaired contextual fear extinction. Thus, sphingosine-1-phosphate and SphK2 play specific roles in memory functions and FTY720 may be a useful adjuvant therapy to facilitate extinction of aversive memories.