Background: University students are vulnerable to developing mental health problems due to constant exposure to academic demands. A situation that has been exacerbated by the COVID-19 pandemic and observed in several recent studies. Therefore, current practices require further research and identification of potentially protective factors for mental health. Objective: This study aimed to analyze academic self-efficacy as a protective factor against depression, anxiety, and stress in university students. Methods: A cross-sectional design was used with 3525 university students from Lima, Peru. The prevalence of depression, anxiety, and stress was measured using the DASS-21. Academic self-efficacy was measured with the EPAESA and defined as a predictor of the three mental health conditions. Structural equation modeling was used to test the model, together with a multigroup analysis for gender and working status. Results: One-third of the sample had severe to extremely severe symptoms of depression, anxiety, and stress. Academic self-efficacy was a moderately statistically significant predictor of the three mental health conditions. Relationships were invariant to gender and working status. Conclusions: Self-efficacy can be considered a protective factor for mental health. Interventions to promote academic self-efficacy may be effective in reducing depression, anxiety, and stress in university students. The findings are discussed together with current studies on the topic.