As World trade is growing rapidly, the reduction of the environmental impact of in-port operations towards a low or zero-emission scenario is becoming a paramount issue. To this aim, replacing Diesel engines of cargo handling equipment used in port logistics (e.g. reach stackers, forklifts, yard tractors, etc.) with cleaner propulsion alternatives may play a major role. In this study, a robust rule-based energy management strategy is proposed for a newly developed fuel cell/battery hybrid powertrain of a yard tractor used for roll-on and roll-off in-port operations. As typical port operations are characterized by mission profiles that can vary significantly in terms of driving and duty cycles during the same work-shift, the proposed strategy, built upon the observation of the powertrain behavior under the application of an optimal controller, dynamically adapts the operation of fuel cell and battery in order to track a predefined battery state of charge trajectory, while minimizing the hydrogen consumption. The use of an optimal model-based approach as a reference for the design of an online implementable energy management strategy is indeed particularly suitable in the present case: despite their inherent high variability, the yard tractor mission profiles can be regarded as the combination of a set of predictable parameters. Results show that the application of the proposed control strategy allows the hybrid powertrain to achieve excellent performance, by leading its components to run efficiently and across suitable operative conditions. The achieved hydrogen consumption, for the considered missions, is only 2%–3% higher than that of the optimal controller, despite a quite different evolution of the battery state of charge, that is the feedback control variable. By means of this strategy, the transient loading of the fuel cell is prevented, while the battery pack ensures the fulfillment of the peak power requests, with beneficial effects in terms of on-board stored energy exploitation. The key advantage of the developed rule-based approach lies in its robustness, reliability and online applicability in real-time powertrain control.