Tissue-resident memory T (TRM) cells persist indefinitely in epithelial barrier tissues and protect the host against pathogens1,2,3,4. However, the biological pathways that enable the long-term survival of TRM cells are obscure4,5. Here we show that mouse CD8+ TRM cells generated by viral infection of the skin differentially express high levels of several molecules that mediate lipid uptake and intracellular transport, including fatty-acid-binding proteins 4 and 5 (FABP4 and FABP5). We further show that T-cell-specific deficiency ofFabp4andFabp5(Fabp4/Fabp5) impairs exogenous free fatty acid (FFA) uptake by CD8+ TRM cells and greatly reduces their long-term survivalin vivo,while having no effect on the survival of central memory T (TCM) cells in lymph nodes.In vitro, CD8+ TRM cells, but not CD8+ TCM cells, demonstrated increased mitochondrial oxidative metabolism in the presence of exogenous FFAs; this increase was not seen inFabp4/Fabp5double-knockout CD8+ TRM cells. The persistence of CD8+ TRM cells in the skin was strongly diminished by inhibition of mitochondrial FFA β-oxidationin vivo. Moreover, skin CD8+ TRM cells that lackedFabp4/Fabp5were less effective at protecting mice from cutaneous viral infection, and lungFabp4/Fabp5double-knockout CD8+ TRM cells generated by skin vaccinia virus (VACV) infection were less effective at protecting mice from a lethal pulmonary challenge with VACV. Consistent with the mouse data, increased FABP4 and FABP5 expression and enhanced extracellular FFA uptake were also demonstrated in human CD8+ TRM cells in normal and psoriatic skin. These results suggest that FABP4 and FABP5 have a critical role in the maintenance, longevity and function of CD8+ TRM cells, and suggest that CD8+ TRM cells use exogenous FFAs and their oxidative metabolism to persist in tissue and to mediate protective immunity.