Hydrogen is not a fuel, but rather an energy carrier, like a battery. It can be electrolyzed from water with excess electricity, stored in tanks, and called upon to be transformed back into electricity when the demand shifts. Hydrogen is not, however, a very efficient energy carrier. This process is often only about 30% efficient, and should be thought of as a fallback and not a priority.
Hydrogen is NOT, however, suitable for use in vehicles. We would need to build an entire infrastructure around this, when we could use electric vehicles (EV) and plug-in hybrid electric vehicles (PHEV) with the existing infrastructure and with something like 1/3 the electricity hydrogen-powered vehicles would require.
See Hydrogen and Fuel Cells Fact Sheet for more information.