Background and objective: Repetitive transcranial magnetic stimulation (rTMS) is a first-line treatment for treatment-resistant depression (TRD). The mechanisms of action of rTMS are not fully understood, and no biomarkers are available to assist in clinical practice to predict response to rTMS. This study aimed to demonstrate that after-rTMS clinical improvement is associated with functional connectivity (FC) changes of the subgenual cingulate cortex (sgACC) and rostral anterior cingulate (rACC), and FC of sgACC and rACC might serve as potential predictors for treatment response. Methods: Resting-state functional magnetic resonance imaging (rs-fMRI) data were collected within 1 week before rTMS initiation in 50 TRD patients to predict subsequent response to rTMS on the left dorsolateral prefrontal cortex (DLPFC). Follow-up rs-fMRI was obtained 12 weeks after completion of rTMS and neural correlates of rTMS in sgACC-and rACC-related FC patterns were compared to before rTMS data and with rs-fMRI from healthy participants. Results: Treatment response was associated with lower FC of sgACC to right DLPFC and higher FC of rACC to left lateral parietal cortex (IPL) measured at baseline. Using sgACC-DLPFC and rACC-IPL connectivity as features, responder-nonresponder classification accuracies of 84% and 76% (end-of-treatment), 88% and 81% (3-month follow-up), respectively were achieved. Longitudinal rs-fMRI data analyses revealed that the hyperconnectivity between sgACC and visual cortex was normalized to a level which was comparable to that of healthy participants. Conclusions: Brain activity patterns in depression are predictive of treatment response to rTMS, and longitudinal change of brain activity in relevant brain circuits after rTMS is associated with treatment response in depression. Target engagement paradigms may offer opportunities to increase the efficacy of rTMS in TRD by optimal selection of patients for treatment. Trial registration: ClinicalTrials.gov Identifiers: NCT01887782 and NCT02800226.