Diabetes induces impairment in cognitive function. There is substantial evidence that hippocampal endoplasmic reticulum (ER) stress is involved in diabetic cognitive impairment. Hydrogen sulfide (H2S) attenuates the learning and memory decline in experimental Alzheimer's disease and inhibits the hippocampal ER stress in homocysteine-exposed rats. Therefore, this aim of the present work was to investigate whether H2S ameliorates the diabetic cognitive dysfunction involving inhibition of hippocampal ER stress. In the present work, we found that stretozotocin (STZ, 40 mg/kg)-induced diabetic rats exhibited impairment in cognitive function, as judged by the novel objective recognition task (NOR) test, the Y-maze test and the Morris water maze (MWM) test. Notably, treatment of diabetic rats with sodium hydrosulfide (NaHS, a donor of H2S, 30 or 100 μmol/kg/d, for 30 d) significantly reversed diabetes-induced impairment in cognitive function. We also found that STZ (40 mg/kg)-induced diabetic rats exhibited hippocampal ER stress, as evidenced by upregulations of glucose regulated protein 78 (GRP78), C/EBP homologous protein (CHOP), and cleaved caspase-12 in the hippocampus. However, treatment with NaHS (30 or 100 μmol/kg/d, for 30 d) markedly suppressed the increases in GRP78, CHOP, and cleaved caspase-12 expressions in the hippocampus of diabetic rats. In addition, we noted that NaHS (30 or 100 μmol/kg/d, for 30 d) significantly enhanced the generation of hippocampal endogenous H2S in STZ-induced diabetic rats. These results suggest that H2S exhibits therapeutic potential for diabetes-associated cognitive dysfunction, which is most likely related to its protective effects against hippocampal ER stress.