Hybrid electric vehicles present a promising approach to reduce fuel consumption and carbon dioxide emissions. The core technology of hybrid electric vehicles is an energy management strategy to distribute torque between the engine and the electric motor. This study presents an optimized energy management strategy based on real-time control. The operation platform of the control system is based on the dSPACE/simulator, which is a commercial hardware closed-loop system. First, an energy management strategy is built by using an empirical analysis method. To reduce fuel consumption further and to maintain the balance of the battery state of charge, dynamic programming is introduced to achieve the best fuel economy. Optimal gear shifting and engine torque control rules are then extracted into a rule-based control algorithm. Meanwhile, genetic algorithm is introduced to optimize the mode transition rules and the engine torque under parallel mode through an iterative method by defining a cost function over specific driving cycles. Second, a driving cycle recognition algorithm is built to obtain the optimization result over different driving cycles. The real vehicle model is verified by using a hardware-in-the-loop simulator in a virtual forward-facing simulation environment. The energy management strategy uses a code generation technology in the TTC200 controller to achieve vehicle real-time communication. Simulation results demonstrate that the real-time energy management strategy can coordinate the overall hybrid electric powertrain system to optimize fuel economy over different driving cycles and to maintain the battery state of charge.