Helicobacter pylori was first isolated from gastritis patients by Barry J. Marshall and J. Robin Warren in 1982, and more than 90% of duodenal ulcers and about 80% of gastric ulcers are caused by H. pylori infection. Most detection methods require sophisticated instruments and professional operators, making detection slow and expensive. Therefore, it is critical to develop a simple, fast, highly specific, and practical strategy for the detection of H. pylori. In this study, we used H. pylori as a target to select unique aptamers that can be used for the detection of H. pylori. In our study, we used random ssDNA as an initial library to screen nucleic acid aptamers for H. pylori. We used binding rate and the fluorescence intensity to identify candidate aptamers. One DNA aptamer, named HPA-2, was discovered through six rounds of positive selection and three rounds of negative selection, and it had the highest affinity constant of all aptamers tested (Kd = 19.3 ± 3.2 nM). This aptamer could be used to detect H. pylori and showed no specificity for other bacteria. Moreover, we developed a new sensor to detect H. pylori with the naked eye for 5 min using illumination from a hand-held flashlight. Our study provides a framework for the development of other aptamer-based methods for the rapid detection of pathogenic bacteria.