With the development of UHVDC transmission, the problem of reactive power shortage in load concentration areas is becoming prominent. The system voltage stability is closely related to reactive power. It is necessary to study the online voltage stability margin prediction in order to provide basis for reactive power compensation. Based on the data resources provided by PMU, an online method for voltage stability margin prediction based on gradient boosting regression tree (GBRT) is proposed. The method is divided into two parts: the establishment of offline operation points database and real-time evaluation. By simulating the load change, the optimal power flow model is solved, and the output state of each generator and the corresponding voltage stability margin are obtained, and the GBRT is trained offline. The experimental results show that the proposed method has higher prediction accuracy than support vector machine, and the time can meet the requirements of real-time prediction. Under the measurement uncertainty, when the signal-to-noise ratio is greater than 40dB, the proposed method is robust to measurement uncertainty. And based on the feature selection ability of the GBRT, it can provide a basis for the placement of the PMU, thereby achieving a balance between system reliability and economics.