In this work, we propose a model-based scheme for the online optimization of coldstart hydrocarbon emission control strategy of an automotive spark-ignited engine during its idle operating conditions. First, the existing model-based control schemes to reduce the coldstart emissions are reviewed and classified. Then, the proposed scheme and the related control-oriented engine model validated by experimental data are introduced. At the heart of the suggested scheme, there is a new optimal control problem formulation for the coldstart that can be solved rapidly using the Pontryagin's minimum principle. This formulation is based on a redefined objective function with weighted terms for the coldstart key variables, that is, the engine-out hydrocarbon emission and the exhaust gas temperature. The weighting numbers for these dominant factors in the redefined objective function are tuned such that the optimum solution becomes close to the minimum of the cumulative tailpipe hydrocarbon emissions. The use of the redefined objective function reduces significantly the computational efforts, resulting in an order of magnitude faster convergence rate than solving the original coldstart hydrocarbon emission minimization problem with a complex form. This important property is demonstrated with some simulation results based on the above-mentioned engine model. This feature makes the new formulation a good fit to the proposed scheme, where measured or estimated state variables of the engine model can be fed back to the control unit to re-calculate online the input profiles, such as the spark timing and the air/fuel ratio. Through online modification of the pre-determined input trajectories obtained from off-line calculations, the control performance degradation in practice due to the plant/model mismatch, which is equivalent to a significant increase of the tailpipe hydrocarbon emissions, can be reduced considerably.