A new, sensitive, and low cost solid-phase extraction method using pyridine-functionalized MCM-48 mesoporous silica for the extraction, pre-concentration, and electrothermal atomic absorption spectrometric determination of nickel and lead in food samples at ng mL−1 levels is described herein. The levels of nickel and lead in different types of vegetables grow in Shiraz–Iran and Rafsanjan–Iran were determined by electrothermal atomic absorption spectrometry. The use of two standard reference materials and also comparing the results to a standard reference procedure ensured the accuracy of this method. Factors, such as flow rate of extraction, and the type, pH, concentration, and volume of eluent, were appraised. The effect of various ions on recovery was also investigated. Detection limits of 0.11 and 0.14 ng mL−1 were obtained for lead and nickel, respectively.