In this work, a turn-on electrochemiluminescence (ECL) sensor for sensitive quantification of melatonin based on graphite carbon nitride (g-C3N4) was prepared on the surface of a glassy carbon electrode (GCE). In this ECL sensor, graphitic carbon nitride nano-sheets (g-C3N4 NSs) were used as an ECL probe. The ECL intensity of the sensor was gradually increased with the addition of melatonin concentration. The possible mechanism for enhanced ECL signal of g-C3N4 by melatonin is investigated and discussed in detail. Under optimal conditions, a novel, sensitive and selective ECL sensor has been constructed for the detection of melatonin, with a wide linear response range from 1.0 × 10-14 to 1.0 × 10-9 M, and an excellent detection limit of 6.2 × 10-15 M (6.2 fM). Furthermore, the proposed sensor was successfully applied to detect melatonin in human saliva samples with excellent precision, remarkable selectivity, and long-lasting stability.