Aims:Previous studies on major depressive disorder (MDD) among immigrants have reported mixed results. Using data from primary healthcare settings in Sweden, we compared the incidence of MDD among first- and second-generation immigrants aged 15–39 years with natives.Methods:This was a retrospective nationwide open cohort study. Eligible individuals were born 1965–1983, aged 15–39 years at baseline, and resided in Sweden for at least one year during the study period 2000–2015. We identified MDD cases through the Primary Care Registry (PCR). The follow-up for each individual started when they met the inclusion criteria and were registered in the PCR and ended at MDD diagnosis, death, emigration, moving to a county without PCR coverage, or the end of the study period, whichever came first. Results: The final sample included 1,341,676 natives and 785,860 immigrants. The MDD incidence rate per 1000 person-years ranged from 6.1 (95% confidence intervals: 6.1, 6.2) to 16.6 (95% confidence intervals: 16.2, 17.0) in native males and second-generation female immigrants with a foreign-born father, respectively. After adjusting for income, the MDD risk did not differ substantially between first-generation male and female immigrants and natives. However, male and female second-generation immigrants had a 16–29% higher adjusted risk of MDD than natives.Conclusions:This cohort study using primary healthcare data in Sweden, albeit incomplete, indicated that second-generation immigrants seem to be at a particularly high risk of MDDs. The underlying mechanisms need further investigation.