The common cause of death worldwide is cardiovascular disease caused by arrhythmias, so its diagnosis is of vital importance. To detect it, the main tool is the electrocardiogram (ECG) in which a health professional can detect heart disease. This problem has been solved with different approaches, including fully connected networks, convolutional networks, recurrent networks, where all these approaches try to learn the correct representation of the data. Nevertheless, these techniques are prone to fail into the vanishing/exploding gradient problem when you want to go deeper into the network. The present work proposes an approach of residual convolutional networks with an attention mechanism to classify ECG signals among the different categories of an arrhythmia dataset, with the objective of developing a tool that can collaborate in the early diagnosis of cardiovascular disease. The method uses a convolutional residual neural network as an extractor of ECG signal features. Also it is combined with an attention mechanism that is capable of giving greater importance to the most relevant characteristics of the data for learning, achieving a better feature extractor that will later be fully connected to a network, capable of identifying between the different categories. This network reaches an accuracy of 98.46% and 0.9930 in the AUC metric, managing to improve the results in the state-of-the-art.