Sex differences in the impact of exposure to air pollution have been reported previously and epidemiological studies indicate that fine particulate matter (PM2.5) effects on nonaccidental death are modified by sex; however, the results are not conclusive. To introduce a new method incorporating the monotone nonlinear relationship between PM2.5 and deaths to reveal the sex difference in the relationship, we illustrated the use of the constrained generalized additive model (CGAM) to investigate the sex difference in the effects of PM2.5 on nonaccidental deaths in Shanghai, China. Information on daily non-accidental deaths, air pollution, meteorological data, and smoking prevalence between 1 January 2012 and 31 December 2014 was obtained in Shanghai. The CGAM was used to assess the association of interaction between sex and daily PM2.5 concentrations with daily nonaccidental deaths, adjusting for weather type and smoking rate. A 2-week lag analysis was conducted as a sensitivity analysis. During the study period, the total number of non-accidental deaths in Shanghai was 336,379, with a daily mean of 163 deaths and 144 deaths for men and women, respectively. The average daily concentration of PM2.5 in Shanghai was 55.0 μg/m3 during the same time period. Women showed a lower risk for non-accidental death (risk ratio (RR) = 0.892, 95% confidence interval (CI): 0.802–0.993). Compared with men, the risk for nonaccidental death in relation to increasing PM2.5 concentration was smaller in women (RR = 0.998, 95% CI: 0.996–1.000, per 10 μg/m3 increase in PM2.5 concentration. The difference is consistent during the two lag weeks and more obvious when adjusting for the interaction between PM2.5 concentration and smoking prevalence. The effects of PM2.5 on daily nonaccidental death are different between men and women in Shanghai, China, and women tend to have a lower risk. The underlying mechanisms of the sex difference of PM2.5 effects on death need further investigation. The method displayed in the manuscript can be used for other environmental stressors as well.