A novel method based on auto-moving grid search-least square support vector machine (AGS-LSSVM) is proposed for online predicting ship roll motion in waves. To verify the method, simulation data are used, which are obtained by solving the second-order nonlinear differential equation of ship roll motion using the fourth-order Runge–Kutta method, while the Pierson–Moskowitz spectrum (P–M spectrum) is used to simulate the irregular waves. Combining the sliding time window with the least square support vector machine (LS-SVM), the samples in the time window are used to train the LS-SVM model, and the model hyperparameters are optimized online by the auto-moving grid search (AGS) method. The trained model is used to predict the roll motion in the next 30 seconds, and the prediction results are compared with the simulation data. It is shown that the AGS-LSSVM is an effective method for online predicting ship roll motion in waves.