Remaining useful life (RUL) prediction plays an important role in prognostics and health management (PHM) and can significantly enhance equipment reliability and safety in various engineering applications. Accurate RUL prediction enables proactive maintenance planning, helping prevent potential hazards and economic losses caused by equipment failures. Recently, while deep learning-based methods have swept the RUL prediction field, most existing methods still have difficulties in simultaneously extracting multiscale global and local degradation feature information from raw multi-sensor monitoring data. To address these issues, we propose a novel multiscale global and local self-attention-based network (MGLSN) for RUL prediction. MGLSN consists of global and local feature extraction subnetworks based on self-attention, which work in parallel to simultaneously extract the global and local degradation features of equipment and can adaptively focus on more important parts. While the global network captures long-term dependencies between time steps, the local network focuses on modeling local temporal dynamics. The design of parallel feature extraction can avoid the mutual influence of information from global and local aspects. Moreover, MGLSN adopts a multiscale feature extraction design (multiscale self-attention and convolution) to capture the global and local degradation patterns at different scales, which can be combined to better reflect the degradation trend. Experiments on the widely used Commercial Modular Aero-Propulsion System Simulation (CMAPSS), New CMAPSS (N-CMAPSS), and International Conference on Prognostics and Health Management 2008 challenge datasets provided by NASA show that MGLSN significantly outperforms state-of-the-art RUL prediction methods and has great application prospects in the field of PHM.