We consider a single localized spin-1/2 between the singlet superconducting leads of a Josephson junction (e.g., a superconducting STM). For the spin subject to a dc magnetic field Bparallel toz, we study the spin dynamics and the possibility to measure the spin state via transport through the junction embedded in a dissipative circuit. Turning on the tunneling or a voltage bias induces oscillations of the Josephson current, with an amplitude sensitive to the initial value of the z component of the spin, S-z=+/-1/2. At low temperatures, when effects of quasiparticles are negligible, this procedure realizes a quantum nondemolition measurement of S-z.