A resistor limits the flow of electric current by providing opposition to the flow of electrons in a circuit. This opposition is due to the resistor's property of resistance, which is measured in ohms. As current flows through a resistor, the resistor converts some of the electrical energy into heat, dissipating it in the form of infrared radiation. This conversion of energy reduces the flow of electrons in the circuit, effectively limiting the current.