We estimated the risk of blood clots after COVID-19 vaccination accounting for the roles of vaccination in reducing the infection rate, and indirectly lowering the risk of blood clots caused by infection. A self-controlled case series method was used to examine the association between blood clots and COVID-19 vaccination. To deal with the bias due to under-reported infection among non-hospitalized subjects, a case-control study was used to compare the risk of blood clots in infected subjects to control subjects who were hospitalized due to physical injury. We found increased risks of blood clots after vaccination (incidence rate ratio is 1.13, 95% confidence interval (CI): [1.03, 1.24] after the first dose and 1.23, 95% CI: [1.13,1.34] after the second dose). Furthermore, vaccination attenuated the increased risk of blood clots associated with infection (odds ratio (OR) = 2.16, 95% CI: [1.93, 2.42] in unvaccinated versus OR=1.46, 95% CI: [1.25, 1.70] in vaccinated). A causal model was used to explain and weigh up possible risk factors for blood clots after COVID-19 vaccination. After accounting for vaccine efficacy against infection and the protection against infection-associated blood clots, receiving the COVID-19 vaccines decreases the risk of blood clots, especially during high infection rate period.