A rapid, sensitive and accurate method for the simultaneous extraction and determination of five types of trace phthalate esters (PAEs) in environmental water and beverage samples using magnetic molecularly imprinted solid-phase extraction (MMIP–SPE) coupled with gas chromatography–mass spectrometry (GC–MS) was developed. A novel type of molecularly imprinted polymers on the surface of yolk-shell magnetic mesoporous carbon (Fe3O4@void@C–MIPs) was used as an efficient adsorbent for selective adsorption of phthalate esters based on magnetic solid–phase extraction (MSPE). The real samples were first preconcentrated by Fe3O4@void@C–MIPs, subsequently extracted by eluent and finally determined by GC–MS after magnetic separation. Several variables affecting the extraction efficiency of the analytes, including the type and volume of the elution solvent, amount of adsorbent, extraction time, desorption time and pH of the sample solution, were investigated and optimized. Validation experiments indicated that the developed method presented good linearity (R2>0.9961), satisfactory precision (RSD<6.7%), and high recovery (86.1–103.1%). The limits of detection ranged from 1.6ng/L to 5.2ng/L and the enrichment factor was in the range of 822–1423. The results indicated that the novel method had the advantages of convenience, good sensitivity, and high efficiency, and it could also be successfully applied to the analysis of PAEs in real samples.