An apparatus for DNP-NMR measurement on a sample, with a magnet configuration for producing a magnetic field in a first working volume and in, a second working volume with a magnetic field gradient in the direction of an axis (z) which extends through the second working volume, with a device for measuring MR signals, with a DNP excitation device, and with a positioning mechanism for transferring the sample, is characterized in that, near the second working volume, a compensation configuration made of magnetic material is mounted that, in the operating condition of the magnet configuration, produces a magnetic field gradient in the direction of the axis (z) in the second working volume that is between −90% and −110% of the magnetic field gradient of the same order of the stray field of the magnet configuration.