Hans Christian Oersted discovered the connection between electricity and magnetism in 1820. While giving a lecture where he passed an electric current through a wire, he noticed a nearby compass needle deflected from its normal position pointing north. He realized the current must be producing a magnetic field. This demonstrated that electric currents produce magnetic fields. Oersted had unlocked a fundamental relationship between electricity and magnetism.