Based on the quantitative analysis theory and algorithm of power system stability, i.e. extended equal area criterion(EEAC), a new method is presented for implementing transient security constrained optimal power flow(OTS). The method divides OTS into two sub-problems, namely the conventional OPF and transient security preventive control. The stability mode based preventive control searches optimal preventive control measures subject to transient stability and security constraints on the basis of OPF operating point. According to the preventive control calculation results, transient stability and security constraints are converted into inequality constraints of control variables which are incorporated into OPF model. OTS is therefore solved by this decoupling and iteration process of the two sub-problems. The effectiveness of the new method is verified by the simulation results using Guangdong power system data.