The continuous outbreaks of foodborne diseases have drawn public attentions to food safety. Early screening of foodborne pathogens is crucial to prevent and control of foodborne diseases. In this study, a novel electrochemical aptasensor was developed for rapid and sensitive detection of E. coli O157:H7 using the coaxial capillary with immune magnetic nanoparticles (MNPs) for specific separation of the target bacteria, the urease with urea for amplification of the impedance signals, and the PCB gold electrode for measurement of the impedance change. The streptavidin modified MNPs were conjugated with the biotinylated polyclonal antibodies (PAbs) to form the immune MNPs, and captured in the coaxial capillary with the line-up high gradient magnetic fields to separate the bacteria from the large volume of sample. Then, the gold nanoparticles (GNPs) were modified with the aptamers against E. coli and the urease, and injected into the capillary to react with the bacteria and form the MNP-PAb-bacteria-aptamer-GNP-urease complexes. Finally, the urease on the complexes was used to catalyze the hydrolysis of urea into ammonium ions and carbonate ions in the capillary, leading to the decrease in the impedance of the catalysate, which was measured by the gold plating PCB electrode. The impedance change of the catalysate and the concentration of the bacteria had a good linear relationship. This aptasensor was able to detect E. coli as low as 101 CFU/mL in 3 h, and the mean recovery of E. coli in the spiked pasteurized milk was ~99%. This proposed aptasensor has the potential for practical applications of foodborne pathogen detection due to its short detection time, high sensitivity and low cost.