Identical hand-cranked generators can be used to show that a generator can function as a motor and vice versa. If mechanical energy is put into the one of the devices by turning the crank, electrical energy can be produced. If that electrical energy in the form of voltage is applied to the other, then mechanical energy can be produced (motor action).
In the video below, the crank of one of the devices is turned to put in mechanical energy, resulting in electrical energy at the output. The handle of the other device is turned because electrical input is operating it as a motor. The last segment of the film lines up the handles of the devices and then turns the generator 1 turn. You can observe that the handle of the "motor" turns about 60% of a turn, indicating an efficiency of about 60% for the generator/motor exchange. But that is almost twice the efficiency of the electric generation system of the U.S., which yields electricity at about 33% efficiency! The reason is that this generator/motor pair does not have to go through the "thermal bottleneck" imposed by the second law of thermodynamics on the common electrical generation plants which operate as heat engines.
The high efficiency of the transfer of energy from a generator to a motor finds widespread application in the operation of diesel-electric locomotives. It is difficult to mechanically transfer energy from the powerful diesel engines to the wheels of the locomotive which have low-friction metal-to-metal contact with the steel rails. So the power of the diesel engines is used to run a generator, and the generated electric power is used to operate electric traction motors to drive the wheels. The generated electric power can be very slowly and smoothly transferred to the wheels by the electric motors which drive the axles. You don't "pop the clutch" on a big locomotive with steel-on-steel wheels! You would just sit and spin the wheels until you melted the rails.