Mercury is a non-essential trace element that is toxic to humans due to the bioaccumulation effect. In this work, a ferrofluid based on Fe3O4@graphene oxide nanospheres together with an ionic liquid was used to develop a magnetic dispersive solid-phase extraction (MDSPE) method for the extraction of the complex formed between the chelating agent methyl thiosalicylate (MTS) and mercury. This MDSPE methodology was combined with an automatic analysis by flow injection-cold vapour-graphite furnace atomic absorption spectrometry (FI-CV-GFAAS). The developed semiautomatic method was applied to the determination of ultra-trace amounts of Hg(II) in biological and environmental samples. Several analytical parameters for MDSPE and FI-CV-GFAAS, such as pH, MTS concentration, eluent composition, extraction time, etc., were optimized by uni and multivariate methodologies. Under the optimized conditions, the %RSD, detection limit and determination limit were 2.9%, 0.25 ng L−1 and 4.9 ng L−1, respectively. The achieved preconcentration factor with the MDSPE methodology was 250. The accuracy of the proposed method was verified using a Standard Reference Material (Mussel Tissue SRM 2976) and by determining the analyte content in spiked seawater and tap water samples collected from Málaga and Cádiz (Spain). The determined values were in good agreement with the certified values and the recoveries for the spiked samples were close to 100% in all cases. The results showed that the proposed method is simple, rapid, environmentally friendly, highly sensitive and accurate for determination of mercury in biological and environmental samples.