Powerline interference (PLI) is a major source of interference in the acquisition of electroencephalogram (EEG) signal. Digital notch filters (DNFs) have been widely used to remove the PLI such that actual features, which are weak in energy and strongly connected to brain states, can be extracted explicitly. However, DNFs are mathematically implemented via discrete Fourier analysis, the problem of overlapping between spectral counterparts of PLI and those of EEG features is inevitable. In spite of their effectiveness, DNFs usually cause distortions on the extracted EEG features, which may lead to incorrect diagnostic results. To address this problem, we investigate an adaptive sparse detector for reducing PLI. This novel approach is proposed based on sparse representation inspired by self-adaptive machine learning. In the coding phase, an overcomplete dictionary, which consists of redundant harmonic waves with equally spaced frequencies, is employed to represent the corrupted EEG signal. A strategy based on the split augmented Lagrangian shrinkage algorithm is employed to optimize the associated representation coefficients. It is verified that spectral components related to PLI are compressed into a narrow area in the frequency domain, thus reducing overlapping with features of interest. In the decoding phase, eliminating of coefficients within the narrow band area can remove the PLI from the reconstructed signal. The sparsity of the signal in the dictionary domain is determined by the redundancy factor. A selection criteria of the redundancy factor is suggested via numerical simulations. Experiments have shown the proposed approach can ensure less distortions on actual EEG features.