The article describes a magnetic nanocomposite (mag-NC) that was obtained by oxidative polymerization of thionine in the presence of Fe3O4 nanoparticles. The mag-NC was characterized by FTIR spectroscopy, scanning electron microscopy, energy-dispersive X-ray spectroscopy and vibrating sample magnetometry. It is shown that the mag-NC represents a useful sorbent for magnetic solid-phase extraction of cobalt(II) at trace levels from water and foodstuff samples prior to its determination by FAAS. The effect of pH value, sorbent dose, shaking time and interfering ions on extraction efficiency were optimized. Figures of merits include (a) preconcentration factor of 50, (b) good linearity in the concentration range from 1.3 to 140.0 ng mL−1, (c) a 0.3 ng mL−1 detection limit; and (d) the intra- and inter-day relative standard deviations (for n = 6) of 1.9 and 2.8 %, respectively. Appropriate recovery values, ranging from 96.0 to 104.9 %, were also obtained for real samples analyses.