In this study, a novel strategy for the ultrasensitive and selective detection of Hg2+ based on aptasensor was designed. First, Fe3O4@SiO2 magnetic nanoparticles were employed for the immobilization of primary aptamer ssDNA (S1) and magnetic separation. Then, graphen that have many functional groups have been chosen as the carrier for conjugation CdS nanoparticles and secondary aptamer ssDNA (S2). Graphen load a large amount of CdS nanoparticles which can amplify the signal by graphite furnace atomic absorption spectrometry and sensitivity of the proposed method increased. In the presence of Hg2+, due to strong and stable thymine-Hg2+-thymine (T-Hg2+-T) complex which release graphen-CdS-S2 from double-stranded DNA (dsDNA) and the concentration of cadmium was increased. Under the optimal conditions, the proposed aptasensor showed a wide linear range from 2.5 aM to 0.25 nM with a detection limit of 0.3 aM (S/N = 3). The proposed aptasensor exhibited high selectivity for Hg2+ even in the presence of other interfering metal ions when their concentration ratio was more than 1000 times. Finally, the aptasensor was applied for Hg2+ detection in the tap and mineral water samples.