As of the end of 2019, the world suffered from a disease caused by the SARS-CoV-2 virus, which has become the pandemic COVID-19. This aggressive disease deteriorates the human respiratory system. Patients with COVID-19 can develop symptoms that belong to the common flu, pneumonia, and other respiratory diseases in the first four to ten days after they have been infected. As a result, it can cause misdiagnosis between patients with COVID-19 and typical pneumonia. Some deep-learning techniques can help physicians to obtain an effective pre-diagnosis. The content of this article consists of a deep-learning model, specifically a convolutional neural network with pre-trained weights, which allows us to use transfer learning to obtain new retrained models to classify COVID-19, pneumonia, and healthy patients. One of the main findings of this article is that the following relevant result was obtained in the dataset that we used for the experiments: all the patients infected with SARS-CoV-2 and all the patients infected with pneumonia were correctly classified. These results allow us to conclude that the proposed method in this article may be useful to help physicians decide the diagnoses related to COVID-19 and typical pneumonia.