Klebsiella pneumoniae (KP) is an important gram-negative zoonotic conditional pathogen. It can infect humans and a variety of farm animals, leading to infections such as pneumonia, meningitis and even sepsis. thereby posing a significant threat to public health. OmpX acts as a virulence protein that can participate in bacterial pathogenesis, mediates bacterial adhesion to and invasion of epithelial cells, and is involved in bacterial adaptation to the osmotic pressure of the external environment. In this study, MBs-SELEX was used as the main strategy for screening aptamers. Omp X was used as the target protein and Omp A as the counter-screening target. qPCR and flow cytometry were used to determine the nature and specificity of the obtained aptamers for the Omp X protein. The analysis showed that among the obtained aptamers, three aptamers, Apt-1, Apt-2 and Apt-3, were selected with Kd values of 62.50 nM, 22.05 nM and 7.9 nM, respectively. In addition, total internal reflection fluorescence microscopy (TIRFM) was used for the characterization of KP in complex with specific FITC-labeled aptamers (FITC-Apt-3) and AuNCs. The complexes were characterized by observing blue fluorescent dots from AuNCs and green fluorescent dots from FITC-labeled aptamers overlapping with bacterial presence. These results suggest that AuNCs and aptamers can specifically bind to target bacteria, forming complexes. Furthermore, in vitro results demonstrated that Apt-1, Apt-2 and Apt-3 inhibited bacterial growth, with Apt-3 having the most significant inhibitory effect. The results suggest that aptamers can selectively recognize membrane proteins, thereby disrupting bacterial cell membrane formation and effectively inhibiting bacterial growth. Aptamers have a potential mechanism to inhibit bacterial growth.