Occupational stress is a complex concept resulting from interaction among personnel, work environment, and cultural contexts. It can cause mental health issues, including clinical mental disorders, as well as emotional challenges like depression, anxiety, cognitive difficulties, and feeling sad. As a vulnerable group, healthcare professionals, especially nurses, experience a high rate of occupational stress. Therefore, we aimed to study the relationship between occupational stress, mental health problems, and self-efficacy among the nursing population. A cross-sectional study was conducted among 365 nurses selected through a two-stage sampling process from tertiary hospitals in Qazvin, Iran, between July and September 2022. Study variables included occupational stress measured by the persian version of the health and safety executive management standards revised indicator tool (MS-RIT), the general health questionnaire containing 28 questions measuring psychological distress in four primary areas of somatic and anxiety symptoms, sleep disorders, social dysfunction, and depression [GHQ–28], and general self-efficacy [GSE–10]. The mentioned variables and some of the nurses’ demographic characteristics, including age, gender, education, and work experience, were analyzed using moderated multiple regression, descriptive statistics, and the Pearson correlation coefficient.The Pearson correlation analysis revealed a statistically significant association between self-efficacy and occupational stress (r = 0.62, P = 0.000) and self-efficacy and mental health (r = 0.67, P = 0.01). Regression analysis demonstrated that occupational stress accounted for 42% of the variation in mental health (R2 = 0.42, P < 0.01). The results also showed that self-efficacy moderates the relationship between occupational stress and mental health, with a significant effect (P < 0.01). The elevated prevalence of occupational stress and the concerning state of mental health among nurses highlight the need for the implementation of intervention programs, including stress prevention strategies at the workplace through organizing better working shifts, as well as increasing nurses’ self-efficacy and their effective participation in work-related tasks aiming to enhance working conditions for nurses.