  A single spin in a Josephson junction can reverse the flow of the
supercurrent. At mesoscopic length scales, such $\pi$-junctions are employed in
various instances from finding the pairing symmetry to quantum computing. In
Yu-Shiba-Rusinov (YSR) states, the atomic scale counterpart of a single spin in
a superconducting tunnel junction, the supercurrent reversal so far has
remained elusive. Using scanning tunneling microscopy (STM), we demonstrate
such a 0 to $\pi$ transition of a Josephson junction through a YSR state as we
continuously change the impurity-superconductor coupling. We detect the sign
change in the critical current by exploiting a second transport channel as
reference in analogy to a superconducting quantum interference device (SQUID),
which provides the STM with the required phase sensitivity. The measured change
in the Josephson current is a signature of the quantum phase transition and
allows its characterization with unprecedented resolution.
