This paper presents a prediction-based algorithm designed to address out-of-step (OOS) conditions in power systems. The algorithm utilizes generator data obtained from phasor measurement units. The transient stability of a multi-machine power system is evaluated using the equal-area criterion (EAC). The proposed algorithm calculates the characteristics of the P-δ curves within the EAC framework after a large disturbance. The critical P-δ trace is determined by analysing the cumulative energy in the acceleration area following fault clearance. The stability margin of the rotor angle is then computed based on the actual active power and its relationship with the critical curve. The algorithm predicts the occurrence of OOS by comparing the measured active power with the corresponding value on the critical curve. Furthermore, a complementary strategy is proposed to predict the OOS condition in integrated inverter-based power systems. The effectiveness of the proposed algorithm is validated through simulations conducted on the 73-bus IEEE test power system.