Background. The different incidence rates of, and risk factors for, depression in different countries argue for the need to have a specific risk algorithm for each country or a supranational risk algorithm. We aimed to develop and validate a predictD-Spain risk algorithm (PSRA) for the onset of major depression and to compare the performance of the PSRA with the predictD-Europe risk algorithm (PERA) in Spanish primary care. Method. A prospective cohort study with evaluations at baseline, 6 and 12 months. We measured 39 known risk factors and used multi-level logistic regression and inverse probability weighting to build the PSRA. In Spain (4574), Chile (2133) and another five European countries (5184), 11 891 non-depressed adult primary care attendees formed our at-risk population. The main outcome was DSM-IV major depression (CIDI). Results. Six variables were patient characteristics or past events (sex, age, sex x age interaction, education, physical child abuse, and lifetime depression) and six were current status [Short Form 12 (SF-12) physical score, SF-12 mental score, dissatisfaction with unpaid work, number of serious problems in very close persons, dissatisfaction with living together at home, and taking medication for stress, anxiety or depression]. The C-index of the PSRA was 0.82 [95% confidence interval (CI) 0.79-0.84]. The Integrated Discrimination Improvement (IDI) was 0.0558 [standard error (S.E.) = 0.0071, Z(exp) = 7.88, p < 0.0001] mainly due to the increase in sensitivity. Both the IDI and calibration plots showed that the PSRA functioned better than the PERA in Spain. Conclusions. The PSRA included new variables and afforded an improved performance over the PERA for predicting the onset of major depression in Spain. However, the PERA is still the best option in other European countries.