The purpose of this paper is to examine the causal impact of the duration of retirement on the cognitive functioning of male elderly workers in Japan using data from the National Survey of Japanese Elderly. We explore how the complexity of a worker's longest served job affects cognitive functioning after retirement. In particular, we investigate eight dimensions of the longest served job using information listed in the United States Dictionary of Occupational Titles, namely physical demands, mathematical development, reasoning development, language development, the job's relationship to data, the job's relationship to people, the job's relationship to things and the specific vocational preparation required. Our estimator takes account of the potential endogeneity of the duration of retirement and the left-censoring of the duration of retirement. Our empirical evidence suggests that the duration of retirement has a negative and significant impact on cognitive functioning. Moreover, among the eight dimensions of job characteristics, high complexity in the job's relation to data is found to be an important job characteristic in delaying the deterioration of cognitive functioning after retirement.