  Trapped atoms and ions are among the best controlled quantum systems which
find widespread applications in quantum information, sensing and metrology. For
molecules, however, a similar degree of control is currently lacking owing to
their complex energy-level structure. Quantum-logic protocols in which atomic
ions serve as probes for molecular ions are a promising route for achieving
this level of control, especially with homonuclear molecules that decouple from
black-body radiation. Here, a quantum-non-demolition protocol on single trapped
N$_2^+$ molecules is demonstrated. The spin-rovibronic state of the molecule is
detected with more than 99% fidelity and the position and strength of a
spectroscopic transition in the molecule are determined, both without
destroying the molecular quantum state. The present method lays the foundations
for new approaches to molecular precision spectroscopy, for state-to-state
chemistry on the single-molecule level and for the implementation of molecular
qubits.
