Introduction: SARS-CoV-2 infection is associated with an increased risk of venous thromboembolism. Data are lacking on how this risk altered during the COVID-19 pandemic and following vaccination. We aimed to evaluate the 90-day risk of postoperative venous thromboembolism during the pandemic. Methods: We performed a retrospective cohort study of patients having abdominal, obstetric, orthopaedic, cardiac, thoracic or vascular surgical procedures using the OpenSAFELY-TPP platform. Crude 90-day risks of venous thromboembolism were calculated and crude and adjusted hazard ratios were derived from individual Cox proportional hazards models. Results: In total, 1,800,540 procedures were performed with 15,390 individual venous thromboembolic events recorded within 90 days. The highest crude absolute risk was in the Alpha wave at 1.2%. Postoperative SARS-CoV-2 infection was associated with a 4.4-fold increase in relative risk of 90-day venous thromboembolism (adjusted hazard ratio 4.42, 95%CI 4.21–4.64) compared with those without. Recent SARS-CoV-2 infection was associated with an increased risk of venous thromboembolism (adjusted hazard ratio 4.03, 95%CI 3.78–4.30) compared with those without. Patients who were unvaccinated had the highest relative risk for 90-day venous thromboembolism. A single dose of vaccine was associated with a 20% relative risk reduction of venous thromboembolism (adjusted hazard ratio 0.80, 95%CI 0.76–0.84). Discussion: SARS-CoV-2 infection status and vaccination history were associated with 90-day venous thromboembolism risk, with both recent and postoperative SARS-CoV-2 infection associated with an increased risk, whilst one dose of vaccine reduced the risk.