Speaker is one of the most general electronic transducer, yes !! speakers are transducer because they convert one form of energy(electric) to another(sound). Depending on the type of speaker their internal assembly and manufacturing may be little different but almost all the speakers work on the principle of electromagnetism. We all might have observed that we hear sound when the diaphragm (that black paper) vibrates, but lets see how the whole thing works!!.
Take a close look at the picture below, here we have shown speakers assembly ..
The most important thing here is to note is that "iron metal" and "copper coil" both are attached to the diaphragm, and vibrates along with the diaphragm. Now as we apply small voltage to the coil, the coil magnetizes "iron metal" (simple electromagnetic concept). As you can see adjacent to "iron metal" there is a "permanent magnet" also present in assembly. Since north/south pole generated in the "iron metal" changes with the direction of current flow in "copper coil", and depending on this direction of current "iron metal" will either attract or repel "permanent magnet" as per simple magnetic law (same poles repel each other and opposite poles attract). As the amount of current and direction changes frequently the diaphragm vibrates rapidly which results into generation of sound.