Objective: Characterizing heart rate variability (HRV) in neonates has gained increased attention and is helpful in quantifying maturation and risk of sepsis in preterm infants. Raw data used to derive HRV in a clinical setting commonly contain noise from motion artifacts. Thoracic surface electromyography (sEMG) potentially allows for pre-emptive removal of motion artifacts and subsequent detection of interbeat interval (IBI) of heart rate to calculate HRV. We tested the feasibility of sEMG in preterm infants to exclude noisy raw data and to derive IBI for HRV analysis. We hypothesized that a stepwise quality control algorithm can identify motion artifacts which influence IBI values, their distribution in the time domain, and outcomes of nonlinear time series analysis. Approach: This is a prospective observational study in preterm infants <6 days of age. We used 100 sEMG measurements from 24 infants to develop a semi-automatic quality control algorithm including synchronized video recording, threshold-based sEMG envelope curve, optimized QRS-complex detection, and final targeted visual inspection of raw data. Main results: Analysis of HRV from sEMG data in preterm infants is feasible. A stepwise algorithm to exclude motion artifacts and improve QRS detection significantly influenced data quality (34% of raw data excluded), distribution of IBI values in the time domain, and nonlinear time series analysis. The majority of unsuitable data (94%) were excluded by automated steps of the algorithm. Significance: Thoracic sEMG is a promising method to assess motion artifacts and calculate HRV in preterm neonates.