Fuel cells are essentially inexhaustible batteries -- as long as they're supplied with fuel, they don't lose charge. Within a fuel cell a simple electrochemical process takes place that converts hydrogen and oxygen into electricity, with heat and water as the only emissions.
Every fuel cell consists of an electrolyte membrane sandwiched between two electrodes: a positive electrode called an anode and a negative electrode called a cathode. Hydrogen (or hydrogen-rich fuel) is passed over the anode where a catalyst splits it into ions and electrons. The electrons cannot pass through the electrolyte material and instead travel around it via an electrical circuit to reach the other side of the cell. This flow of electrons is electricity.
The following U.S. Department of Energy animation illustrates how a fuel cell uses hydrogen and oxygen to produce electricity.
*This animation requires Macromedia Flash Player(1) to be installed on your computer.