Hepatocellular carcinoma (HCC) is one the most common malignancies and has poor prognosis in patients. The aim of the present study is to explore the clinical significance of the main genes involved in the Janus kinase (JAK)-signal transducer and activator of transcription (STAT) pathway in HCC. GSE14520, a training cohort containing 212 hepatitis B virus-infected HCC patients from the Gene Expression Omnibus database, and data from The Cancer Genome Atlas as a validation cohort containing 370 HCC patients, were used to analyze the diagnostic and prognostic significance for HCC. Joint-effect analyses were performed to determine diagnostic and prognostic significance. Nomograms and risk score models were constructed to predict HCC prognosis using the two cohorts. Additionally, molecular mechanism analysis was performed for the two cohorts. Prognosis-associated genes in the two cohorts were further validated for differential expression using reverse transcription-quantitative polymerase chain reaction of 21 pairs of hepatitis B virus-infected HCC samples. JAK2, TYK2, STAT3, STAT4 and STAT5B had diagnostic significance in the two cohorts (all area under curves >0.5; P≤0.05). In addition, JAK2, STAT5A, STAT6 exhibited prognostic significance in both cohorts (all adjusted P≤0.05). Furthermore, joint-effect analysis had advantages over using one gene alone. Molecular mechanism analyses confirmed that STAT6 was enriched in pathways and terms associated with the cell cycle, cell division and lipid metabolism. Nomograms and risk score models had advantages for HCC prognosis prediction. When validated in 21 pairs of HCC and non-tumor tissue, STAT6 was differentially expressed, whereas JAK2 was not differentially expressed. In conclusion, JAK2, STAT5A and STAT6 may be potential prognostic biomarkers for HCC. JAK2, TYK2, STAT3, STAT4 and STAT5B may be potential diagnostic biomarkers for HCC. STAT6 has a role in HCC that may be mediated via effects on the cell cycle, cell division and lipid metabolism.