Some cardiovascular risk factors (CVRFs) that occur differently in men and women can be addressed to reduce the risk of suffering a major adverse cardiovascular event (MACE). Furthermore, the development of MACE is highly influenced by social determinants of health. Counterfactual decomposition analysis is a new methodology that has the potential to be used to disentangle the role of different factors in health inequalities. This study aimed to assess sex differences in the incidence of MACE and to estimate how much of the difference could be attributed to the prevalence of diabetes, hypertension, hypercholesterolaemia and socioeconomic status (SES). Descriptive and counterfactual analyses were conducted in a population of 278515 people with CVRFs. The contribution of the causal factors was estimated by comparing the observed risk ratio with the causal factor distribution that would have been observed if men had been set to have the same factor distribution as women. The study period was between 2018 and 2021. The most prevalent CVRF was hypercholesterolaemia, which was similar in both sexes, while diabetes was more prevalent in men. The incidence of MACE was higher in men than in women. The main causal mediating factors that contributed to the sex differences were diabetes and SES, the latter with an offsetting effect. This result suggests that to reduce the MACE gap between sexes, diabetes prevention programmes targeting men and more gender-equal salary policies should be implemented.