Aim To evaluate direct medical costs incurred by patients with diabetes in the periods before and after experiencing a microvascular complication from a Brazilian public healthcare system perspective. Materials and methods This was a retrospective, observational study using the Brazilian Unified Health System (DATASUS) database. Direct medical costs (hospitalization and outpatient) were extracted for patients with evidence of diabetes and a microvascular complication (January 2012–December 2018) and converted to 2019 US Dollars (USD). Length of hospital stays was also extracted. Mixed-effects logistic regression explored associations between demographic/clinical characteristics and incurrence of high direct medical costs (defined as the highest tertile of the annual costs ranked by median cost in the total population). Results In total, 2,096 patients with diabetes experienced a microvascular complication and met study inclusion/exclusion criteria. Median [interquartile range] annual costs (USD/patient) were 176.3 [91.0; 481.2] at baseline, increasing to 1,678.5 [287.0; 6,908.4] and 5,172.4 [274.8; 7,395.9] in the first and second year after the complication, respectively. Median hospital stay was 2.0 and 3.0 days at baseline and in the first year, respectively. The odds of incurring high costs were substantially elevated in the first and second years (odds ratios of 69.9 and 84.7, respectively, vs. baseline, both p < .001). Limitations The DATASUS database covers secondary and tertiary care (not primary), adding selection bias to our sample. Additionally, our findings may not apply to the entire Brazilian population, as around 25% have some access to private healthcare. Conclusions This study demonstrates a large increase in costs, from the perspective of the Brazilian public healthcare system, in patients with diabetes after experiencing a microvascular complication compared with pre-complication costs. In addition to providing up-to-date cost estimates, our findings highlight the need to appraise the cost-effectiveness of evidence-based strategies that reduce the risk of diabetes-related microvascular complications in Brazilian patients.