Importance: Depression is a frequent comorbid condition in patients with persistent back pain and is associated with substantial adverse consequences, including the risk of developing opioid use disorders. Shifting the focus from depression treatment to preventing depression might be a viable way to reduce the disease burden. Objective: To evaluate the effectiveness of a web-based self-help intervention to reduce the incidence of major depressive episode (MDE) in patients with persistent back pain. Design, Setting, and Participants: Prevention of Depression in Back Pain Patients (PROD-BP) was a pragmatic, observer-blinded randomized clinical trial with a parallel design conducted in Germany. Eligible adults with a diagnosis of persistent back pain and subclinical depressive symptoms, but who were depression free, were recruited either on-site or after discharge from 82 orthopedic clinics between October 1, 2015, and July 31, 2017. All analyses were conducted according to the intention-to-treat principle from October 31, 2018, to April 30, 2019. Interventions: The intervention group received an e-coach-guided, web-based self-help intervention that was based on cognitive behavioral therapy and tailored to the needs of patients with persistent back pain. The intervention included 6 obligatory modules and 3 optional modules to be completed by participants as well as feedback from e-coaches. Both the intervention and control groups had unrestricted access to treatment as usual. Main Outcomes and Measures: Primary outcome was time to onset of an MDE over a 12-month period as assessed by blinded diagnostic raters using the Structured Clinical Interview for DSM-5. Secondary outcomes included depression severity, quality of life, pain intensity, pain-related disability, pain self-efficacy, work capacity, and user satisfaction assessed with a variety of instruments. Results: A total of 295 participants (mean [SD] age, 52.8 [7.7] years; 184 women [62.4%]) were recruited and randomized to either the intervention group (n = 149) or control group (n = 146). The intervention reduced the risk of MDE onset by 52% (hazard ratio, 0.48; 95% CI, 0.28-0.81; P <.001). Twenty-one participants (14.1%) in the intervention group and 41 participants (28.1%) in the control group experienced an MDE over the 12-month period. The number needed to treat to prevent 1 new case of MDE was 2.84 (95% CI, 1.79-9.44). Conclusions and Relevance: Results of this trial showed that among patients with persistent back pain, depression can be prevented by a guided web-based self-help intervention in addition to treatment as usual. This finding suggests that using a scalable digital approach to integrate psychological treatment into routine pain management is feasible. Trial Registration: German Clinical Trials Register Identifier: DRKS00007960.