Strong noise is one of the toughest problems in the controlled-source electromagnetic (CSEM) method, which highly affects the quality of recorded data. The three main types of noise existing in CSEM data are periodic noise, Gaussian white noise, and nonperiodic noise, among which the nonperiodic noise is thought to be the most difficult to remove. We have developed a novel and effective method for removing such nonperiodic noise by formulating an inverse problem that is based on inverse discrete Fourier transform and several time windows in which only Gaussian white noise exists. These critical locations, which we call reconstruction locations, can be found by taking advantage of the continuous wavelet transform (CWT) and the temporal derivative of the scalogram generated by CWT. The coefficients of the nonperiodic noise are first estimated using the new least-squares method, and then they are subtracted from the coefficients of the raw data to produce denoised data. Together with the nonperiodic noise, we also remove Gaussian noise using the proposed method. We validate the methodology using real-world CSEM data.