Background: Hepatocellular carcinoma (HCC) accounts for 75% of primary liver tumors. Controlling risk factors associated with its development and implementing screenings in risk populations does not seem sufficient to improve the prognosis of these patients at diagnosis. The development of a predictive prognostic model for mortality at the diagnosis of HCC is proposed. Methods: In this retrospective multicenter study, the analysis of data from 191 HCC patients was conducted using machine learning (ML) techniques to analyze the prognostic factors of mortality that are significant at the time of diagnosis. Clinical and analytical data of interest in patients with HCC were gathered. Results: Meeting Milan criteria, Barcelona Clinic Liver Cancer (BCLC) classification and albumin levels were the variables with the greatest impact on the prognosis of HCC patients. The ML algorithm that achieved the best results was random forest (RF). Conclusions: The development of a predictive prognostic model at the diagnosis is a valuable tool for patients with HCC and for application in clinical practice. RF is useful and reliable in the analysis of prognostic factors in the diagnosis of HCC. The search for new prognostic factors is still necessary in patients with HCC.