An electromagnet produces a magnetic field only when an electric current flows through it, whereas a permanent magnet retains its magnetism indefinitely. Additionally, the strength of an electromagnet can be controlled, but a permanent magnet has a fixed strength.