An atomic deuterium maser operating on hyperfine transitions was used to measure the ground-state hyperfine separation in deuterium. The result was ν0(D)=327 384 352.5222(17) Hz where the hydrogen hyperfine frequency is assumed to be exactly 1420 405 751. 768 Hz. The construction of the device is discussed and a theory of the deuterium maser is presented with special attention given to frequency shifts occurring in the output frequency. In addition, a possible shift of the deuteron Larmor frequency because of the earth's gravitational field was also investigated and found to be <10-4 Hz.