Nucleos(t)ide analogues (NAs) are widely used for antiviral therapy in patients with chronic hepatitis B (CHB), but real-world data on treatment patterns and long-term clinical outcomes are not always available. Using data from electronic medical records between January 2011 and December 2016 in Shanghai, China, we evaluated patient characteristics, treatment patterns and clinical outcomes in patients with CHB. There were 6688 patients in the study cohort. The incidences of cirrhosis and hepatocellular carcinoma (HCC) were 41.0‰ and 6.8‰ person-years, respectively. There were more cirrhosis and HCC cases among patients who had shorter NA treatment duration (<365 days), or who were less compliant (<80%). In addition, increased risk of cirrhosis and HCC was observed in patients who did not achieve hepatitis B surface antigen (HBsAg) loss/seroconversion. Moreover, patients with cirrhosis developed after antiviral treatments had a higher incidence of HCC (adjusted hazard ratio 15.86, 95% confidence interval 7.35–34.24). Good compliance with treatment and longer treatment duration significantly decreased the risk of developing cirrhosis and HCC. HBsAg loss seemed to be a protective factor for cirrhosis/HCC in NAs-treated patients with CHB, and cirrhosis was a confirmed risk factor for HCC development as expected.