For many intraoperative decisions surgeons depend on frozen section pathology, a technique developed over 150 y ago. Technical innovations that permit rapid molecular characterization of tissue samples at the time of surgery are needed. Here, using desorption electrospray ionization (DESI) MS, we rapidly detect the tumor metabolite 2-hydroxyglutarate (2-HG) from tissue sections of surgically resected gliomas, under ambient conditions and without complex or time-consuming preparation. With DESI MS, we identify isocitrate dehydrogenase 1-mutant tumors with both high sensitivity and specificity within minutes, immediately providing critical diagnostic, prognostic, and predictive information. Imaging tissue sections with DESI MS shows that the 2-HG signal overlaps with areas of tumor and that 2-HG levels correlate with tumor content, thereby indicating tumor margins. Mapping the 2-HG signal onto 3D MRI reconstructions of tumors allows the integration of molecular and radiologic information for enhanced clinical decision making. We also validate the methodology and its deployment in the operating room: We have installed a mass spectrometer in our Advanced Multimodality Image Guided Operating (AMIGO) suite and demonstrate the molecular analysis of surgical tissue during brain surgery. This work indicates that metabolite-imaging MS could transform many aspects of surgical care.