According to the World Health Organization, around 36% of the annual deaths are associated with cardiovascular diseases and 90% of heart attacks are preventable. Electrocardiogram signal analysis in ambulatory electrocardiography, during an exercise stress test, and in resting conditions allows cardiovascular disease diagnosis. However, during the acquisition, there is a variety of noises that may damage the signal quality thereby compromising their diagnostic potential. The baseline wander is one of the most undesirable noises. In this work, we propose a novel algorithm for BLW noise filtering using deep learning techniques. The model performance was validated using the QT Database and the MIT-BIH Noise Stress Test Database from Physionet. In addition, several comparative experiments were performed against state-of-the-art methods using traditional filtering procedures as well as deep learning techniques. The proposed approach yields the best results on four similarity metrics: the sum of squared distance, maximum absolute square, percentage of root distance, and cosine similarity with 4.29 (6.35) au, 0.34 (0.25) au, 45.35 (29.69) au and, 91.46 (8.61) au, respectively. The source code of this work, containing our method and related implementations, is freely available on Github.