In the present study, a novel quantitative method, namely magnetic nanoparticle-based solid-phase extraction (MSPE), was applied to extract vitamin B-12 from pharmaceutical formulations. The technique involves the use of Fe3O4 nanoparticles modified by sodium dodecyl sulfate (SDS) as an efficient adsorbent for solid-phase extraction of vitamin B-12. Collection of magnetic nanoparticles (MNPs) from aqueous solution was simply achieved by applying external magnetic field. The analyte was desorbed from MNPs using alkali 1-propanol. The extracted analyte was analyzed by using flow injection inductively coupled plasma-optical emission spectrometry. Factors affecting the extraction efficiency were investigated and optimized. Under the optimum conditions, enhancement factor of 184, linear dynamic range of 2.5-500 mu g L-1 with correlation of determination (R (2) > 0.999), and limit of detection of 1.0 mu g L-1 were obtained for vitamin B-12. The percent relative standard deviation based on five-replicate determination was less than 6.2%. The method was successfully applied for extraction and determination of vitamin B-12 in different types of pharmaceutical samples such as multivitamin tablet, effervescent tablet, and injection sample. The results showed that the proposed method based on SDS-Fe3O4 MSPE was a simple, accurate, and highly efficient approach for analysis of vitamin B-12.