Sleep has great effect on physical health and quality of life. Electroencephalogram (EEG) signal is used in studying sleep process and recently, time–frequency transforms are increasingly utilised in EEG signal analysis. This study proposes an efficient method for sleep stages classification based on a time–frequency transform, namely Stockwell transform. In the introduced method, at first, the Stockwell transform is used to map each 30 s epoch of EEG signal into the time–frequency domains, which results in a complex-valued matrix. Then, the frequency domain is divided into different non-overlapping segments, leading to several matrices. After that, entropy features are extracted from the obtained matrices. In order to determine the sleep stage of each epoch, the computed features are applied to classifier. Support vector machine, weighted K-nearest neighbour, and ensemble bagged tree classifiers are considered. The Pz–Oz and Fpz–Cz channels of EEG signal from Sleep-EDF data set and C3–A2 channel from ISRUC-Sleep data set are used in this research. The results indicate that the proposed method outperforms the recently introduced methods.