This paper presents a novel strategy, optimized by genetic algorithms, to control stand-alone hybrid renewable electrical systems with hydrogen storage. The strategy optimizes the control of the hybrid system minimizing the total cost throughout its lifetime. The optimized hybrid system can be composed of renewable sources (wind, PV and hydro), batteries, fuel cell, AC generator and electrolyzer. If the renewable sources produce more energy than the one required by the loads, the spare energy can be used either to charge the batteries or to produce H2 in the electrolyzer. The control strategy optimizes how the spare energy is used. If the amount of energy demanded by the loads is higher than the one produced by the renewable sources, the control strategy determines the most economical way to meet the energy deficit. The optimization of the various system control parameters is done using genetic algorithms. This paper explains the strategy developed and shows its application to a PV–diesel–battery–hydrogen system.