Background: Rheumatoid arthritis (RA) is a chronic, immune-mediated inflammatory disease of the joints that has been associated with variation in the peripheral blood methylome. In this study, we aim to identify epigenetic variation that is associated with the response to tumor necrosis factor inhibitor (TNFi) therapy. Methods: Peripheral blood genome-wide DNA methylation profiles were analyzed in a discovery cohort of 62 RA patients at baseline and at week 12 of TNFi therapy. DNA methylation of individual CpG sites and enrichment of biological pathways were evaluated for their association with drug response. Using a novel cell deconvolution approach, altered DNA methylation associated with TNFi response was also tested in the six main immune cell types in blood. Validation of the results was performed in an independent longitudinal cohort of 60 RA patients. Findings: Treatment with TNFi was associated with significant longitudinal peripheral blood methylation changes in biological pathways related to RA (FDR<0.05). 139 biological functions were modified by therapy, with methylation levels changing systematically towards a signature similar to that of healthy controls. Differences in the methylation profile of T cell activation and differentiation, GTPase-mediated signaling, and actin filament organization pathways were associated with the clinical response to therapy. Cell type deconvolution analysis identified CpG sites in CD4+T, NK, neutrophils and monocytes that were significantly associated with the response to TNFi. Interpretation: Our results show that treatment with TNFi restores homeostatic blood methylation in RA. The clinical response to TNFi is associated to methylation variation in specific biological pathways, and it involves cells from both the innate and adaptive immune systems. Funding: The Instituto de Salud Carlos III.