In this study, a simple, rapid, and efficient analytical method was proposed for the preconcentration and determination of trace amounts of cadmium and chromium in vegetable samples using magnetic solid-phase extraction (MSPE) coupled with electrothermal atomic absorption spectrometry (ETAAS) detection. Magnetic multi-walled carbon nanotubes (MWCNTs) as an effective adsorbent were synthesized and characterization was performed using scanning electron microscope, transmission electron microscopy, Fourier-transform infrared spectroscopy, X-ray diffraction, and vibrating-sample magnetometer. The experimental parameters were optimized using Box-Behnken design and maximum absorbance of Cd (II) and Cr (VI) was obtained at pH = 5, adsorbent dosage of 0.02 and 0.12 g, ligand concentration of 4 mu g L-1, and extraction time of 22.5 min. The accuracy was assessed through proper recoveries in the range of 58.63-99.03% and 62.86-89.69% for Cd (II) and Cr (VI), respectively. In addition, precision was evaluated with a relative standard deviation (RSD) below 2.8% for both analytes. Linearity was in the range of 5-100 mu g L-1 for both metal ions. The limit of detection and limit of quantification values were found below 0.3 mu g L-1 and 0.3 mu g L-1 using the ETAAS technique, respectively. The magnetic MWCNTs as a promising and low-cost adsorbent can be used in MSPE along with AAS approaches for the extraction and determination of heavy metal ions in several vegetable samples.