Mass spectrometry is used in a wide range of scientific disciplines including proteomics, pharmaceutics, forensics, and fundamental physics and chemistry. Given this ubiquity, there is a worldwide effort to improve the efficiency and resolution of mass spectrometers. However, the performance of all techniques is ultimately limited by the initial phase-space distribution of the molecules being analyzed. Here, we dramatically reduce the width of this initial phase-space distribution by sympathetically cooling the input molecules with laser-cooled, co-trapped atomic ions, improving both the mass resolution and detection efficiency of a time-of-flight mass spectrometer by over an order of magnitude. Detailed molecular dynamics simulations verify the technique and aid with evaluating its effectiveness. Our technique appears to be applicable to other types of mass spectrometers.