The Surrounding Field Compensation (SFC) system described in this work is installed around the four-layer Mu-metal magnetic shield of the neutron electric dipole moment spectrometer located at the Paul Scherrer Institute. The SFC system reduces the DC component of the external magnetic field by a factor of about 20. Within a control volume of approximately 2.5m x 2.5m x 3m disturbances of the magnetic field are attenuated by factors of 5 to 50 at a bandwidth from $10^{-3}$ Hz up to 0.5 Hz, which corresponds to integration times longer than several hundreds of seconds and represent the important timescale for the nEDM measurement. These shielding factors apply to random environmental noise from arbitrary sources. This is achieved via a proportional-integral feedback stabilization system that includes a regularized pseudoinverse matrix of proportionality factors which correlates magnetic field changes at all sensor positions to current changes in the SFC coils.