  Magnetic flux noise is a dominant source of dephasing and energy relaxation
in superconducting qubits. The noise power spectral density varies with
frequency as $1/f^\alpha$ with $\alpha \sim 1$ and spans 13 orders of
magnitude. Recent work indicates that the noise is from unpaired magnetic
defects on the surfaces of the superconducting devices. Here, we demonstrate
that adsorbed molecular O$_2$ is the dominant contributor to magnetism in
superconducting thin films. We show that this magnetism can be suppressed by
appropriate surface treatment or improvement in the sample vacuum environment.
We observe a suppression of static spin susceptibility by more than an order of
magnitude and a suppression of $1/f$ magnetic flux noise power spectral density
by more than a factor of 5. These advances open the door to realization of
superconducting qubits with improved quantum coherence.
