Compensation for a field-perturbing element in a magnetictracking system for locating a probe is achieved by creating areaction field model while the field-perturbing element is inknown positions. A magnetic field location sensor is disposedbetween the field-perturbing element and magnetic field generatorsof the tracking system. Magnetic field readings from thelocation sensor and from a magnetic field sensor on the probeare taken while the field-perturbing element is present. Theposition of the field-perturbing element is estimated from thelocation sensor readings, and a predicted reaction field calculatedfrom the reaction field model. A compensated measurementis obtained by subtracting the predicted reaction field fromthe field detected by the location sensor. The readings fromthe probe sensor are adjusted using the compensated measurementin order to calculate the true position of the probe.