We present a method for removing environmental noise from physiological recordings such as Magnetoencephalography (MEG) for which noise-sensitive reference channels are available. Sensor signals are projected on a subspace spanned by the reference channels augmented by time-shifted and/or nonlinearly transformed versions of the same, and the projections are removed to obtain “clean” sensor signals. The method compensates for scalar, convolutional or non-linear mismatches between sensor and reference channels by synthesizing, for each reference/sensor pair, a filter that is optimal in a least-squares sense for removal of the artifact. The method was tested with synthetic and real MEG data, typically removing up to 98% of noise variance. It offers an alternative to bulky and costly magnetic shielding (multiple layers of aluminium and mu-metal) for present scientific and medical applications and future developments such as brainmachine interfaces (BMI).