A rapid, accurate, and ecofriendly pretreatment plays an extremely important role prior to ICP-MS for heavy metal analysis. In order to improve the pretreatment efficiency, a high-throughput and automatic magnetic solid-phase extraction of five heavy metals (Cd, Pb, Mn, Cu, and Zn) was carried out by a magnet-controlled pretreatment system with an ecofriendly diluted acid as an extracting agent and carboxyl-functionalized magnetic beads as a pretreatment material. Key conditions, including the pH, adsorption time, and eluent solution, were optimized. The time for purification and enrichment was only 8 min. The adsorption capacities of the carboxyl-functionalized magnetic beads were in the range of 152~426 mg g-1. The preconcentration factor of Cu was 40, and others were 200. In the optimal conditions, the limits of detection for Mn, Zn, Cd, Cu, and Pb by ICP-MS were 3.84, 2.71, 0.16, 11.54, and 6.01 ng L-1, respectively. The percentage recoveries were in the range of 80~110%, and the relative standard deviations were less than 3%. The developed method was in good agreement with traditional standard microwave digestion. Additionally, the designed system could simultaneously process up to 24 samples within 22 min, reducing the time to less than 1 min/sample. Thus, the proposed auto-MSPE-ICP-MS method was successfully applied to analyze five heavy metals in cereals and feeds with a simple operation and high precision, safety, and reliability.