While Oersted's surprising discovery of electromagnetism paved the way for more practical applications of electricity, it was Michael Faraday who gave us the key to the practical generation of electricity: electromagnetic induction. Faraday discovered that a voltage would be generated across a length of wire if that wire was exposed to a perpendicular magnetic field flux of changing intensity.
An easy way to create a magnetic field of changing intensity is to move a permanent magnet next to a wire or coil of wire. Remember: the magnetic field must increase or decrease in intensity perpendicular to the wire (so that the lines of flux "cut across" the conductor), or else no voltage will be induced: