The spectrum of the Schr\"odinger operator in a quantum waveguide is known to
be unstable in two and three dimensions. Any enlargement of the waveguide
produces eigenvalues beneath the continuous spectrum. Also if the waveguide is
bent eigenvalues will arise below the continuous spectrum. In this paper a
magnetic field is added into the system. The spectrum of the magnetic
Schr\"odinger operator is proved to be stable under small local deformations
and also under small bending of the waveguide. The proof includes a magnetic
Hardy-type inequality in the waveguide, which is interesting in its own