ObjectiveThis study compared the incidence of pericarditis and myocarditis in patients exposed to mRNA COVID-19 vaccines to the incidence in those who were not vaccinated, considering the incidence of these conditions resulting from COVID-19 infection. MethodsThis was a retrospective cohort study of individuals assigned to health area of La Paz University Hospital in Spain. The exposure factor was vaccination with mRNA COVID-19 vaccines between December 27th, 2020 and January 9th, 2022 with a minimum follow-up of one month. The outcome was the incidence of pericarditis or myocarditis in these individuals. ResultsThe incidence of pericarditis and myocarditis in the total population exposed to at least one dose of mRNA COVID-19 vaccines was 5/100,000 (CI95%:3 to 8 per 100,000), compared to 70/100,000 (CI95%: 66 to 92 per 100,000) in those who were not vaccinated. In the adolescent population (aged 12–17), the incidence was 10/100,000 in vaccinated population (CI95%: 5 to 45 per 100,000) compared to 20/100,000 in unvaccinated (CI95%: 6 to 79 per 100,000). The incidence of pericarditis or myocarditis in patients with COVID-19 infection was 200/100,000 people (CI95%: 114 to 306 per 100,000). The most common cause of pericarditis and myocarditis in the cohort was idiopathic/infectious (74 cases). Cases of myocarditis attributed to COVID-19 infection were more severe and had higher mortality rates compared to cases with other causes. ConclusionThe incidence of pericarditis and myocarditis in patients exposed to mRNA COVID-19 vaccines was lower than in those who were not vaccinated, especially in adults.The most common cause of pericarditis and myocarditis was idiopathic/infectious, but the most frequent cause in adolescent patients was mRNA COVID-19 vaccination. Cases of myocarditis due to COVID-19 infection were more severe and had greater mortality.