A novel DNA sensor for the detection of the Escherichia coli O157:H7 (E. coli O157:H7) eaeA gene was constructed using surface enhanced fluorescence (SEF). The spacing distance dependence nature of Au@Ag nanorods surface enhanced fluorescence was investigated when the cy3-labled single strand DNA(ssDNA) and the stem-loop DNA probe modified on the nanorods was co-hybridized. The result revealed that the fluorescence intensity reached the maximum value with the spacing distance of about 10nm between cy3 and the Au@Ag nanorods surface. Based on this result, a fluorescence "ON/OFF" switch for detecting the eaeA gene of E. coli O157:H7 was constructed. Under optimal conditions, the DNA sensor produced a linear range from 10(-17) to 10(-11) M with a correlation coefficient of 0.9947 and a detection limit of 3.33×10(-18) M, and was also found to be specific in targeting eaeA. The DNA sensor demonstrated a new strategy of combining eaeA recognition and Au@Ag nanorods for fluorescence signal enhancement, and increased sensitivity in the detection of bacterial specific genes.