BACKGROUND: Cancer patients are particularly vulnerable during the COVID-19 pandemic. Vaccinations are essential in controlling the pandemic. However, due to their exclusion from clinical trials for COVID-19 vaccines, there is limited data on the vaccines' effectiveness and safety for this group. OBJECTIVES: We evaluated humoral (anti-S antibody) and cellular (T-cell) immune response in patients with solid cancer on systemic anticancer treatment versus healthy controls prime-vaccinated by the BNT162b2 COVID-19 mRNA vaccine. METHODS: CoVigi was the phase IV prospective open-label non-randomized multicentric clinical trial evaluating anti-S and anti-N SARS-CoV-2 antibodies and SARS-CoV-2-specific T-cell response by IFN-γ-release assay in several time points during the prime COVID-19 mRNA vaccination (prior to the first vaccine dose, prior to the second dose, at 4-8 weeks, at 3 months, and 6 months after vaccination). Immune response was analyzed in the context of previous SARS-CoV-2 infection and anticancer therapy (chemotherapy (CT) + monoclonal antibodies (mAb), mAb, immune checkpoint inhibitors, tyrosine kinase inhibitors, and curative radiotherapy). RESULTS: Among 204 patients with solid cancer and 73 healthy controls, 65% of SARS-CoV-2-naïve patients with cancer developed anti-S antibodies after the first vaccine dose, rising to 92% after the second dose. By 6 months, all BNT162b2-vaccinated patients with solid cancer developed antibody response. Patients treated with CT showed impaired both humoral and cellular immune response to BNT162b2 vaccination. Antibody levels in SARS-CoV-2-recovered patients were comparable to healthy controls. T-cell response peaked after the second dose of BNT162b2 and was not significantly impaired in solid cancer patients except those treated with CT. CONCLUSION: Immune response to BNT162b2 COVID-19 mRNA vaccine is substantially shaped by pre-vaccination COVID-19 infection. All patients with solid cancer on active anticancer therapy exhibited seroconversion after COVID-19 vaccination, although the extent of both humoral and cell immune response was substantially hampered in those treated by CT. TRIAL REGISTRATION: EudraCT No. 2021-000566-14 (registration date February 17, 2021).