BackgroundAnti-PD-(L)1 immunotherapy has been recommended for non-small cell lung cancer (NSCLC) patients with lymph node metastases (LNM). However, the exact functional feature and spatial architecture of tumor-infiltrating CD8 + T cells remain unclear in these patients.MethodsTissue microarrays (TMAs) from 279 IA-IIIB NSCLC samples were stained by multiplex immunofluorescence (mIF) for 11 markers (CD8, CD103, PD-1, Tim3, GZMB, CD4, Foxp3, CD31, αSMA, Hif-1α, pan-CK). We evaluated the density of CD8 + T-cell functional subsets, the mean nearest neighbor distance (mNND) between CD8 + T cells and neighboring cells, and the cancer-cell proximity score (CCPS) in invasive margin (IM) as well as tumor center (TC) to investigate their relationships with LNM and prognosis.ResultsThe densities of CD8 + T-cell functional subsets, including predysfunctional CD8 + T cells (Tpredys) and dysfunctional CD8 + T cells (Tdys), in IM predominated over those in TC (P< 0.001). Multivariate analysis identified that the densities of CD8 + Tpredyscells in TC and CD8 + Tdyscells in IM were significantly associated with LNM [OR = 0.51, 95%CI (0.29–0.88),P= 0.015; OR = 5.80, 95%CI (3.19–10.54),P< 0.001; respectively] and recurrence-free survival (RFS) [HR = 0.55, 95%CI (0.34–0.89),P= 0.014; HR = 2.49, 95%CI (1.60–4.13),P= 0.012; respectively], independent of clinicopathological factors. Additionally, shorter mNND between CD8 + T cells and their neighboring immunoregulatory cells indicated a stronger interplay network in the microenvironment of NSCLC patients with LNM and was associated with worse prognosis. Furthermore, analysis of CCPS suggested that cancer microvessels (CMVs) and cancer-associated fibroblasts (CAFs) selectively hindered CD8 + T cells from contacting with cancer cells, and were associated with the dysfunction of CD8 + T cells.ConclusionTumor-infiltrating CD8 + T cells were in a more dysfunctional status and in a more immunosuppressive microenvironment in patients with LNM compared with those without LNM.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12967-023-04154-y.