Aiming at the structural control problem under earthquake excitation, an instantaneous optimal predictive control algorithm is proposed, which comprehensively considers the influence of displacement, control force input energy and seismic wave energy on the structure in the control process, which solves the problem that the traditional open-loop control must know the external disturbance information in the whole process, and uses the fine integration method to solve the exponential matrix in the control process to avoid solving the eigenvalues and eigenvectors of the dynamic state matrix. The calculation of the exponential matrix in the algorithm is simplified, and the calculation efficiency is improved, so that the algorithm has the advantages of high efficiency, high precision, insensitivity to step size, and unconditional convergence. In the example, the method in the paper is compared with the LQG algorithm, which proves that the effectiveness of the proposed algorithm is better than the LQG algorithm.