Previous data suggest that persistent back pain may be associated with genetic variability. In this study, we assessed the correlation between 8 genetic polymorphisms (VDR, COL11, MMP1, MMP9, IL-1α, IL-1RN, OPRM1, COMT) and pain recovery in patients with low back pain (LBP) and lumbar radicular pain (LRP). In total, 296 patients with LBP or LRP were followed for 5 years. The patients underwent standardized clinical examination and completed pain and function questionnaires. Univariate linear regression associations with P values <0.1 were included in the multivariable analysis, adjusting for pain intensity at baseline, age, sex, smoking, body mass index, and LBP or LRP. Pain intensity at 5-year follow-up was associated with VDR rs731236 (B = −0.5, 95% confidence interval [CI] −0.9 to −0.1, P = 0.017), MMP9 rs17576 (B = 0.5, 95% CI 0.1-0.9, P = 0.022), and OPRM1 rs1799971 (B = −0.8, 95% CI −1.4 to −0.2, P = 0.006) in the univariate analyses. MMP9 rs17576 and OPRM1 rs1799971 remained significant (B = 0.4, 95% CI 0.05-0.8, P = 0.026 and B = −0.8, 95% CI −1.3 to −0.2, P = 0.007) in the multivariable model. Thus, the data demonstrated that the rare allele of MMP9 rs17576 was associated with poor pain recovery, whereas the rare allele of OPRM1 rs1799971 was associated with better pain recovery at 5-year follow-up in the LBP and LRP patients. In particular, the present study suggested that the OPRM1 rs179971 A>G in men was associated with better long-term pain recovery. In men, the OPRM1 rs1799971 explained 4.7% of the variance of pain intensity. We conclude that the MMP9 rs17576 and OPRM1 rs1799971 genotypes may affect 5-year recovery in patients with LBP and LRP.