It has been reported that suicide is associated with ambient temperature; however, the heterogeneity in this association and its underlying factors have not been extensively investigated. Therefore, we investigated the spatial and temporal variation in the temperature-suicide association and examined climatic, demographic, and socioeconomic factors that may underlie such heterogeneity. We analyzed the daily time-series data for the suicide counts and ambient temperature, which were collected for the 47 prefectures of Japan from 1972 to 2015, using a two-stage analysis. In the first stage, the prefecture-specific temperature-suicide association was estimated by using a generalized linear model. In the second stage, the prefecture-specific associations were pooled, and key factors explaining the spatial and temporal variation were identified by using mixed effects meta-regression. Results showed that there is an inverted J-shape nonlinear association between temperature and suicide; the suicide risk increased with temperature but leveled off above 24.4 degrees C. The nationwide relative risk (RR) for the maximum suicide temperature versus 5th temperature percentile (2.9 degrees C) was estimated as 1.26 (95% CI: 1.22, 1.29). The RRs were larger for females than for males (1.32 vs. 1.22) and larger for elderly people (>= 65 y) than for the non-elderly (15-64 y) (1.51 vs. 1.18). The RRs were larger for rural prefectures, which are characterized by smaller population, higher proportions of females and elderly people, and lower levels of financial capability and the proportion of highly educated people. The RRs were also larger in colder and less humid prefectures. These findings may help in understanding the potential mechanism of the temperature-suicide association and projecting the future risk of suicide under climate change.