Large differences in mortality rates across those with different levels of education are a well-established fact. Cognitive ability may be affected by education so that it becomes a mediating factor in the causal chain. In this paper, we estimate the impact of education on mortality using inverse-probability-weighted (IPW) estimators. We develop an IPW estimator to analyse the mediating effect in the context of survival models. Our estimates are based on administrative data, on men born between 1944 and 1947 who were examined for military service in the Netherlands between 1961 and 1965, linked to national death records. For these men, we distinguish four education levels and we make pairwise comparisons. The results show that levels of education have hardly any impact on the mortality rate. Using the mediation method, we only find a significant effect of education on mortality running through cognitive ability, for the lowest education group that amounts to a 15% reduction in the mortality rate. For the highest education group, we find a significant effect of education on mortality through other pathways of 12%.