BACKGROUND: Depression is a common and serious psychiatric disorder with significant impacts on individuals. Modified electroconvulsive therapy (MECT) is an established treatment for severe and treatment-resistant depression, but its cognitive side effects, particularly memory impairments, limit its use. Esketamine (ESK), an FDA-approved antidepressant, has shown neuroprotective effects. However, its role in mitigating MECT-induced cognitive deficits remains unexplored. This study investigates whether ESK could alleviate MECT-induced signs of cognitive impairments in a rat model of depression and explores the underlying mechanisms. METHODS: Male Sprague-Dawley rats were exposed to chronic unpredictable mild stress (CUMS) model to induce depressive-like behaviors. Rats were then subjected to MECT, ESK treatment, or both. Depression-like behaviors and cognitive functions were evaluated using various tests. Molecular and cellular assays were performed to assess hippocampal neuronal apoptosis, inflammation, and synaptic plasticity, with a focus on the Krüppel-like factor 4 (KLF4) and p38 MAPK signaling pathways. RESULTS: MECT treatment significantly alleviated depressive-like symptoms but exacerbated cognitive impairments, hippocampal neuronal apoptosis, and neuroinflammation. ESK co-treatment improved depressive behaviors while reversing MECT-induced cognitive deficits, reducing hippocampal apoptosis, and decreasing inflammatory cytokine levels. Furthermore, ESK enhanced synaptic plasticity and upregulated KLF4 expression, which in turn inhibited the activation of the p38 MAPK pathway. Functionally, knockdown of KLF4 diminished the neuroprotective effects of ESK, confirming its critical role in mediating cognitive protection. CONCLUSIONS: Esketamine mitigates METC-induced cognitive impairment in the animal model, by upregulating KLF4, which inhibits the p38 MAPK pathway, offering a potential therapeutic strategy for improving cognitive outcomes in patients undergoing ECT.