BACKGROUND: Cocaine use disorder (CUD) is a global condition lacking effective treatment. Repetitive transcranial magnetic stimulation (rTMS) may reduce craving and frequency of cocaine use, but little is known about its efficacy and neural effects. We sought to elucidate short- and long-term clinical benefits of 5-Hz rTMS as an add-on to standard treatment in patients with CUD and discern underlying functional connectivity effects using magnetic resonance imaging. METHODS: A total of 44 patients with CUD were randomly assigned to complete the 2-week double-blind randomized controlled trial (acute phase) (sham [n~= 20, 2 female] and active [n~= 24, 4 female]), in which they received two daily sessions of rTMS on the left dorsolateral prefrontal cortex (PFC). Subsequently, 20 patients with CUD continued to an open-label maintenance phase for 6 months (two weekly sessions for up to 6 mo). RESULTS: rTMS plus standard treatment for 2 weeks significantly reduced craving (baseline: 3.9 $±$ 3.6; 2 weeks: 1.5 $±$ 2.4, p~= .013, d~= 0.77) and impulsivity (baseline: 64.8 $±$ 16.8; 2 weeks: 53.1 $±$ 17.4, p~= .011, d~= 0.79) in the active group. We also found increased functional connectivity between the left dorsolateral PFC and ventromedial PFC and between the ventromedial PFC and right angular gyrus. Clinical and functional connectivity effects were maintained for 3 months, but they dissipated by 6 months. We did not observe reduction in positive results for cocaine in urine; however, self-reported frequency and grams consumed for 6 months were reduced. CONCLUSIONS: With this randomized controlled trial, we show that 5-Hz rTMS has potential promise as an adjunctive treatment for CUD and merits further research.