Hydrogen has great potential as an alternative fuel for internal combustion engines (ICE) because of its high energy density by mass, high specific heat ratio, free of CO2 and PM emission, and ultra-low NOx emission. In the present paper, a premixed spark-ignition engine fueled by hydrogen was simulated. 3D combustion CFD was employed to simulate and optimize the engine combustion. Parametric studies of equivalence ratio were conducted to identify the appropriate range for practical operation. It was found that higher equivalence ratio in H2ICE is not feasible since it exhibits very high pressure rise rate and strong pressure oscillations. It is due to its much fast flame speed and detonabiltiy. Frequency analysis was conducted on the predicted pressure trace. The dominant frequencies were compared with the first four drum mode. It was found that the dominant resonance frequency corresponds to the drum mode of (0,1). This is due to the fact that the pressure wave originates from the center of combustion chamber. With an equivalence ratio of 0.4, the engine produces similar pressure trace as the baseline gasoline engine, while its close-cycle work is less than half of the gasoline engine, due to low equivalence ratio and hydrogen's low energy density per unit volume. NOx emission is two order of magnitude lower than the stoichiometric gasoline engine. However, for lean burn PFI H2ICE, N2O emission is much higher than stoichiometric gasoline engine, which needs special attention in the future. Spark timing was swept for the equivalence ratio 0.4 case to further optimize the engine. The mechanisms of NO and N2O formation at different operating conditions are compared and discussed. It was found that NO emission is sensitive to spark timing, while N2O emission is not. The engine-out N2O emission is about one order of magnitude lower than the engine-out NO emission.