A tandem linear ion trap and time-of-flight mass spectrometer, where the ion trap has a straight central axis orthogonal to the flight path of the mass spectrometer. The ion trap comprises a set of electrodes, (401, 403, 402, 404) at least one of the electrodes has a slit for ejecting ions towards the mass spectrometer; a set of DC voltage supplies (+V, −V, V1, V2) to provide discrete DC levels and a number of fast electronic switches (409) for connecting / disconnecting the DC supplies to at least two of the electrodes; a neutral gas filling the ion trap and a digital controller to provide a switching procedure of ion trapping, manipulation with ions, cooling and including a state at which all ions are ejected from the ion trap towards the mass spectrometer.