In this work, fibrous TiO2@g-C3N4 nanocomposites (FTGCNCs) were used for dispersive micro-solid phase extraction of Co and Ni prior to their determination by inductively coupled plasma mass spectrometry. As a new adsorbent, the surface on FTGCNCs have rich functional groups such as-NH2,-NH-and =N-, which can selectively adsorb target ions. The adsorption behaviors of Co and Ni on FTGCNCs were investigated. The results indicated that the analytes were quantitatively retained on FTGCNCs in the pH range of 5.0-8.0 and eluted completely with 1.0 mL of 0.5 mol L-1 HNO3 solution. The main factors influencing the preconcentration and determination of the analytes were investigated in detail, including the pH of the sample solution, dosage of adsorbent, extraction/elution time, elution parameters and sample volumes. Under the optimum conditions, the detection limits of this method were 0.12 pg mL-1 and 1.34 pg mL-1 for Co and Ni, respectively. The relative standard deviations were 3.9% for Co and 4.8% for Ni (n=9, c=1.0 ng mL-1). This method was used for the determination of trace/ultra-trace Co and Ni in environmental water samples with satisfactory results. In order to verify this method, three certified reference materials of stream sediment, human hair and mussel were analyzed using the proposed method, and the determined results were in agreement with the certified values.