It is possible to levitate a small magnetic object in space by actively and continuously controlling the strength of a single electromagnet.
In fact you can buy toys that do this. A sensor determines the height of the object and a signal amplifier adjusts the magnetic field strength.
DIY article here.