The lockdown derived from the declaration of a pandemic due to SARS-CoV-2 in March 2020 by the World Health Organization altered daily activities, including the academic ones, which were adapted to virtuality. In Ecuador, the new modality of study had an increase in the use of electronic devices that triggered new problems. To stablish the prevalence of depression and anxiety among medical students from the Universidad Central del Ecuador (Central University of Ecuador) in virtual education during the COVID-19 pandemic. Cross-sectional analytic study conducted between June and July of 2021 in students from first to tenth semester during virtual education. All studied subjects were evaluated using an electronic survey, depression and anxiety variables were assessed with the BDI-II and GAD-7 scales, respectively. In addition, sociodemographic data were collected, including the family APGAR. A response rate of 63.3% (1528 students) was obtained. Overall prevalence of depression was 37.8% and the prevalence of anxiety 30.3%. Lower-years students were the most affected by these pathologies. The protective factors found were physical activity and psychological support in religion, whereas the main risk factors found were a dysfunctional family, lack of an exclusive study space and low academic performance. Furthermore, the frequency of depression and anxiety was significantly higher in women. The virtual modality showed a high prevalence of depression and anxiety in medical students.