Due to the massive use of thiamethoxam (TMX) pesticide and the accumulated potential hazards exposure, the detection of TMX is of great significance to food and ecological safety. In this study, aptamers with affinity for TMX were obtained through graphene oxide assisted systematic evolution of ligands by exponential enrichment (GO-SELEX). After 9 rounds of positive and counter selection, 5 candidate sequences were obtained, among which seq.20 had the highest affinity for TMX, and its dissociation constant (Kd) was 210.47 ± 79.37 nM. Then, the aptamer was further truncated based on structural analysis. The truncated aptamers (seq.20-1, seq.20-2) exhibited higher affinity (Kd = 118.34 ± 13.85 nM, Kd = 123.35 ± 29.80 nM), which seq.20-2 had only 37 bases. Furthermore, circular dichroism spectroscopy showed that TMX induced the conformation of aptamer from B-form structure to hairpin structure, and then formed a stable TMX-ssDNA complex. Finally, the truncated aptamer (seq.20-2) and the original aptamer (seq.20) were used as recognition elements to construct colorimetric aptasensors based on gold nanoparticles for the detection of TMX. It was found that the sensitivity of the former (LOD = 1.67 ± 0.12 nM, S/N = 3) was better than that of the latter (LOD = 3.33 ± 0.23 nM, S/N = 3). Feasibility of truncated aptamer as recognition element in the detection of TMX in vegetable samples was preliminarily verified.