This study aimed to investigate the initial treatment response and short-term mortality of spontaneous bacterial peritonitis (SBP) in cirrhotic patients with hepatocellular carcinoma (HCC) compared with those without HCC. A total of 245 patients with liver cirrhosis diagnosed with SBP between January 2004 and December 2020 were included. Of these, 107 (43.7%) were diagnosed with HCC. Overall, the rates of initial treatment failure, 7-day and 30-day mortality were 91 (37.1%), 42 (17.1%), and 89 (36.3%), respectively. While the baseline CTP score, MELD score, culture-positive rate, and rates of antibiotic resistance did not differ between both groups, patients with HCC had a higher rate of initial treatment failure than those without HCC patients (52.3% vs. 25.4%, P < 0.001). Similarly, 30-day mortality was also significantly higher in patients with HCC (53.3% vs. 23.2%, P < 0.001). In the multivariate analysis, HCC, renal impairment, CTP grade C, and antibiotic resistance were independent factors for initial treatment failure. Furthermore, HCC, hepatic encephalopathy, MELD score, and initial treatment failure were independent risk factors for 30-day mortality, with statistically significant poor survival outcomes in patients with HCC (P < 0.001). In conclusion, HCC is an independent risk factor for initial treatment failure and high short-term mortality in patients with cirrhosis with SBP. It has been suggested that more attentive therapeutic strategies are required to improve the prognosis of patients with HCC and SBP.