Answer: inhomogeneous magnetic fields. See the Stern–Gerlach experiment.
So basically your spaceship needs to have the core part in a spinning sphere generating such a magnetic field. Also not to forget the gravitational attraction which would make the free particles in space quite attracted to your bulk spaceship, following you like mosquitos :).