Aflatoxin M1 (AFM1), a secondary metabolite of Aspergillus spp., is highly toxic and widely present in food matrices. Therefore, the detection of AFM1 is of great importance for the protection of food safety. In this study, a five-segment sequence was designed as the initial library. Graphene oxide-SELEX (GO-SELEX) was applied to screen AFM1. After seven rounds of repeated screening, affinity and specificity assays showed that aptamer 9 was the best candidate for AFM1. The dissociation constant (Kd) of aptamer 9 was 109.10 ± 6.02 nM. To verify the efficiency and sensitivity aptamer for the detection of AFM1, a colorimetric sensor based on the aptamer was constructed. The biosensor showed good linearity in the range of AFM1 concentration of 0.5-500.0 ng/mL with a detection limit of 0.50 ng/mL. This colorimetric method was successfully used for the detection of AFM1 in milk powder samples. Its detection recovery was 92.8-105.2%. This study was conducted to provide a reference for the detection of AFM1 in food.