Ion sources for molecular mass spectrometry are usually driven by direct current power supplies with no user control over the total charges generated. Here, we show that the output of triboelectric nanogenerators (TENGs) can quantitatively control the total ionization charges in mass spectrometry. The high output voltage of TENGs can generate single- or alternating-polarity ion pulses, and is ideal for inducing nanoelectrospray ionization (nanoESI) and plasma discharge ionization. For a given nanoESI emitter, accurately controlled ion pulses ranging from 1.0 to 5.5 nC were delivered with an onset charge of 1.0 nC. Spray pulses can be generated at a high frequency of 17 Hz (60 ms in period) and the pulse duration is adjustable on-demand between 60 ms and 5.5 s. Highly sensitive (∼0.6 zeptomole) mass spectrometry analysis using minimal sample (18 pl per pulse) was achieved with a 10 pg ml-1 cocaine sample. We also show that native protein conformation is conserved in TENG-ESI, and that patterned ion deposition on conductive and insulating surfaces is possible.