Objective: To investigate the effects of high-frequency repetitive transcranial magnetic stimulation (rTMS) of the right dorsolateral prefrontal cortex (DLPFC) on working memory performance, while measuring task-related brain activation and task-related brain connectivity in patients with multiple sclerosis (MS). Methods: 17 patients with MS and 11 healthy controls (HCs) underwent 3 experimental sessions (baseline, real-rTMS, sham-rTMS), all including an N-back task (3 task loads: N1, N2, N3; control condition: N0) inside the MR scanner. Prior to imaging, real-rTMS (10 Hz) was applied to the right DLPFC. The stimulation site was defined based on individually assessed N-back task activation at baseline and located using neuronavigation. Changes in whole brain functional activation and functional connectivity with the right DLPFC were calculated. Results: N-back task accuracy (N2 and N3) improved after real-rTMS (and not after sham-rTMS) compared with baseline (p=0.029 and p=0.015, respectively), only in patients. At baseline, patients with MS, compared with HCs, showed higher task-related frontal activation (left DLPFC, N2>N0), which disappeared after real-rTMS. Task-related (N1>N0) functional connectivity between the right DLPFC and the right caudate nucleus and bilateral (para)cingulate gyrus increased in patients after real-rTMS when compared with sham stimulation. Conclusions: In patients with MS, N-back accuracy improved while frontal hyperactivation (seen at baseline relative to HCs) disappeared after real-rTMS. Together with the changes in functional connectivity after real-rTMS in patients, these findings may represent an rTMS-induced change in network efficiency in patients with MS, shifting patients' brain function towards the healthy situation. This implicates a potentially relevant role for rTMS in cognitive rehabilitation in MS.