Nanobodies (Nbs) are widely used in immunoassays with the advantages of small size and high stability. Here, the nanobody employed as the surrogate of aflatoxin antigen and the recognition mechanism of antiaflatoxin mAb with nanobody was studied by molecular modeling, which verified the feasibility of Nbs as antigen substitutes. On this basis, a nanobody-alkaline phosphatase fusion protein (Nb-AP) was constructed, and a highly sensitive "on−off−on" fluorescent immunosensor (OFO-FL immunosensor) based on the calcein/Ce 3+ system was developed for aflatoxin quantification. Briefly, calcein serves as a signal transducer, and its fluorescence can be quenched after it is bound with Ce 3+ . In the presence of Nb-AP, AP catalyzed p-nitrophenyl phosphate to generate orthophosphate, which competes in binding with Ce 3+ , leading to fluorescence recovery. The method has a linearity range of 0.005−100 ng/mL, and the IC 50 of the OFO-FL immunosensor was 0.063 ng/mL, which was 18-fold lower than that of conventional enzyme-linked immunosorbent assay. The assay was successfully applied in food samples with a recovery of 88− 121%.