Spectroscopy is a powerful tool for studying molecules and is commonly performed on large thermal molecular ensembles that are perturbed by motional shifts and interactions with the environment and one another, resulting in convoluted spectra and limited resolution. Here, we use generally applicable quantum-logic techniques to prepare a trapped molecular ion in a single quantum state, drive terahertz rotational transitions with an optical frequency comb, and read out the final state non-destructively, leaving the molecule ready for further manipulation. We resolve rotational transitions to 11 significant digits and derive the rotational constant of 40 CaH + to be B R = 142 501 777.9(1.7) kHz. Our approach suits a wide range of molecular ions, including polyatomics and species relevant for tests of fundamental physics, chemistry, and astrophysics.Precision molecular spectroscopy produces information that is essential to understand molecular properties and functions, which underpin chemistry and biology. In particular, microwave rotational spectroscopy can precisely determine various aspects of molecular structure, such as bond lengths and angles, and help identify molecules. However, even in a dilute gas, where the interaction with surrounding molecules is reduced, spectroscopic experiments often fall short of the ultimate resolution set by the natural linewidth of the transitions. This is due to effects that crowd and blur molecular spectra, such as uncontrolled nuclear, rotational, vibrational, and electronic states, line shifts and broadening from external fields, reduced interaction time from time-of-flight, and the Doppler effect. These limitations have motivated efforts toward trapping molecules and cooling them close to absolute zero temperature. Laser cooling and trapping [1-3], which revolutionized atomic physics, have enabled formation of molecules from cold atoms [4] and precision molecular spectroscopy [5]. Direct laser cooling of molecules shows promise for species with advantageous level structures that only require a few laser wavelengths [6-8], but is infeasible for the vast majority of molecules.Furthermore, even with trapped and cooled molecules [9], commonly used detection methods, such as state-dependent photo-dissociation or ionization [10,11], destroy the molecules under study, making them unavailable for further manipulation.In this work, we perform high resolution spectroscopy on rotational states of a molecular ion using methods that are generally applicable to a broad range of molecular ions, which are readily trapped in electromagnetic potentials [12] and cooled by coupling to co-trapped atomic ions amenable to laser cooling [13,14]. The long interrogation times and low translational temperature enabled by trapping and sympathetic cooling lead to high resolution [15], which has, among other advances, enabled the most stringent test of fundamental theory carried out by molecular ions [16]. We prepare a trapped 40 CaH + molecular ion at rest in a single, known quantum state and coherently ...