The aim of this study was to assess short and medium-term impact of the coronavirus disease-2019 (COVID-19) pandemic on stress, mental health, and sleep in Spanish healthcare professionals (HCP), and analyze the association between healthy habits, anxiety, and depression during the same period. An online survey including five validated scales (the Perceived Stress Scale, the Goldberg Anxiety and Depression Scales, the Pre-Sleep Arousal Scale, and the Pittsburgh Sleep Quality Index), and some questions about healthy habits were completed by HCP in charge of patients without and with coronavirus. Once for the control group (baseline), and twice for the case group (baseline and follow-up). Overall 563 questionnaires were included. Moderate-severe stress was reported by 98.1% of subjects, anxiety and depression by 55.1% and 78.7% respectively, and poor sleep quality by 96.6%. Anxiety was reported more frequently by females and singles. HCP in charge of COVID-19 patients showed, in the baseline, a higher frequency of anxiety compared to controls (58.9% vs. 42.8%, p=0.002), and of depression (82.1% vs. 67.6%, p=0.001), that persisted in the follow-up assessment. Furthermore, HCP in charge of COVID-19 patients also exhibited more elevated mean scores for stress (p=0.005) and poor sleep (p=0.019). A decrease of sunlight exposure was associated with an increase of anxiety and depression symptoms, and less physical activity with depression. Stress, sleep, and mental problems were common in Spanish HCP, especially in those in charge of COVID patients. These findings persisted throughout the pandemic, and may impact in the post-pandemic mental health of HCP.