  We present a novel spectroscopy protocol based on optimal control of a single
quantum system. It enables measurements with quantum-limited sensitivity
(\eta_\omega ~ 1/sqrt(T_2^*),T_2^* denoting the system's coherence time) but
has an orders of magnitude larger dynamic range than pulsed spectroscopy
methods previously employed for this task. We employ this protocol to image
nanoscale magnetic fields with a single scanning NV center in diamond. Here,
our scheme enables quantitative imaging of a strongly inhomogeneous field in a
single scan without closed-loop control, which has previously been necessary to
achieve this goal.
