Objective. Electroencephalogram (EEG) signals suffer inevitable interference from artifacts during the acquisition process. These artifacts make the analysis and interpretation of EEG data difficult. A major source of artifacts in EEGs is ocular activity. Therefore, it is important to remove ocular artifacts before further processing the EEG data. Approach. In this study, an automatic ocular artifact removal (AOAR) method for EEG signals is proposed based on non-negative matrix factorization (NMF) and empirical mode decomposition (EMD). First, the amplitude of EEG data was normalized in order to ensure its non-negativity. Then, the normalized EEG data were decomposed into a set of components using NMF. The components containing ocular artifacts were extracted automatically through the fractal dimension. Subsequently, the temporal activities of these components were adaptively decomposed into some intrinsic mode functions (IMFs) by EMD. The IMFs corresponding to ocular artifacts were removed. Finally, the de-noised EEG data were reconstructed. Main results. The proposed method was tested against seven other methods. In order to assess the effectiveness and reliability of the AOAR method in processing EEG data, experiments on ocular artifact removal were performed using simulated EEG data. Experimental results indicated that the proposed method was superior to the other methods in terms of root mean square error, signal-to-noise ratio (SNR) and correlation coefficient, especially in cases with a lower SNR. To further evaluate the potential applications of the proposed method in real life, the proposed method and others were applied to preprocess real EEG data recorded from children with and without attention-deficit/hyperactivity disorder (ADHD). After artifact rejection, the event-related potential feature was extracted for classification. The AOAR method was best at distinguishing the children with ADHD from the others. Significance. These results indicate that the proposed AOAR method has excellent prospects for removing ocular artifacts from EEG data.