Surgical intervention for stage IV non-small cell lung cancer (NSCLC) is still controversial. This study sought to evaluate the clinical effects of surgical intervention on survival in patients with stage IV NSCLCs and to identify the cohort benefitting the most from surgery.A retrospective study from the Surveillance, Epidemiology, and End Results database was performed to compare the survival of stage IV NSCLC patients who had undergone surgery with those who did not undergo surgery. Overall survival (OS) was evaluated using the Kaplan–Meier method and the log-rank test. The Cox proportional hazards model was used for multivariate analysis.The total number of eligible patients was 43,538, including 16.8% in the M1a stage and 83.2% in the M1b stage. The percentages of patients with no surgery (NONE), only metastatic tumor resection (MTR), only primary tumor resection (PTR), and both primary and metastatic tumor resection (PMTR) were 89.0%, 6.7%, 3.5%, and 0.8%, respectively; the corresponding 5-year survival rates were 2.0%, 4.0%, 13.0%, and 20.0%, respectively (P < 0.001); and the corresponding OS rates were 11.1 months, 14.7 months, 29.4 months, and 34.9 months, respectively (P < 0.001). Notably, the pairwise comparisons of 5-year survival rate and OS among the subgroups were all statistically significant. The multivariate analysis showed that surgical intervention was correlated with longer survival in patients with stage IV NSCLC. The stratified analysis showed significant differences in the OS on strata of the M1a stage and strata of the M1b stage. In the M1a stage, patients with PTR had significantly better OS than those with NONE (P < 0.001) or MTR (P < 0.001) but showed no significant differences compared with those with PMTR (P = 0.174); patients with MTR did not have prolonged survival compared with patients with NONE (P = 0.185), and they also did not have prolonged survival compared with patients with PMTR (P = 0.052). In the M1b stage, pairwise comparisons of OS were all statistically significant among the subgroups (P < 0.001).Surgical intervention can prolong survival to different degrees according to the modalities of surgery in stage IV NSCLC.