An electromagnet is a wire around a piece of metal: it is only magnetic as long as a current flows through the wire. But its magnetic field is the same as that of a permanent magnet. You may look at a permanent magnet as a piece of metal that has microscopic currents running inside it, and which maintain the magnetic field.