On earth Hydrogen (H) normally occurs only with other elements, e.g. water (H2O). It now costs enery to divide water into its basic elements.
It can be achieved with the help of an electroliseur.
 

Regard the Model

After the division of water into its basic elements, the Hydrogen can be regarded as a storage of energy. Then you have the opportunity to gain electricity from it by using a fuel cell.
The following picture describes an circle where power is created with the help of an solar-cell. The power then is sent to an electroliseur which divides water into O2 and H2. The Hydrogen is used in a fuel cell to create power and run the motor.

The picture was taken at the H2EXPO in Hamburg.