Fuel cells are sources of clean energy which have become a key enabling technology in a wide spectrum of applications, ranging from automotive and aerospace applications to power supply for off-grid communities. The adequate functioning of a fuel cell requires permanent electrical power delivery to its load, operating at its maximum possible efficiency, even under load variations. Controlling the operating point of the fuel cell to manage changes in load conditions allows extending its service life. Several variables must be monitored and/or controlled to achieve optimal operating conditions of the fuel cell. This work deals with the design of a linear-quadratic-Gaussian, LQG, state-space controller for a proton exchange membrane fuel cell. The LQG controller is commonly used in fuel cell applications because it features an observer which can reconstruct states that are needed for the control strategy and that many times are difficult or too expensive to measure. The tuning of the parameters of the controller is performed by means of genetic algorithms procedures. The goal of the optimization is to prevent low levels of reactant gases due to sudden increases in the load. This will avoid damages to the membrane and other components of the stack while improving the overall performance of the system. The open loop and closed loop system response are presented using the lineal and non-lineal model of the plant. The response of the compensated system using the LQG controller is compared to the response using a basic state space controller, designed by the pole placing method, to assess the robustness of the LQG controller under disturbances. The results demonstrate the ability of the genetic algorithm technique to design a controller that can help preserving the integrity of the fuel cell while optimizing its performance.