An optimal control strategy for recovering the feasible solution of the power flow under specified contingencies is proposed. This algorithm aims to minimize the control cost while recovering the feasibility of the power flow. The recovering process is transformed into a nonlinear programming problem which is solved in two steps, restoring solvability and restoring feasibility. The optimal load shedding method is used to regain power flow solutions under specified contingencies, while a modal analysis is made to determine the participation factors of each bus related to the key instability mode. These participation factors are used to determine a priority list for the optimal power flow tool to minimize the load shedding and re-dispatch of the active/reactive power generation. The primal-dual interior-point algorithm is applied to solving the integrated mixed-integer and nonlinear problem. The simulation results show that the modal analysis has reduced the dimensions of the problem and improved the converging speed, which is important for on-line real-time control.