Compound flooding results from the simultaneous occurrence of extreme storm surges, sea level rise, and heavy rainfall. These events often lead to impacts significantly more severe than those caused by any individual flood-inducing factor alone. However, the limited and sparse data from tidal gauges hampers precise risk assessment at ungauged sites in coastal cities. Our study addresses this gap by integrating ensemble machine learning with Bayesian inference, offering a comprehensive spatial–temporal analysis of compound flood risk from 1979 to 2022 in Hong Kong. We developed an ensemble machine learning approach within the Bayesian hierarchical modeling framework to achieve spatial–temporal continuity in the estimation of extreme storm surges and mean sea level at sites without tidal gauge stations. Results show a significant yearly increase in maximum storm surge levels by 3 mm and a significant rise in mean sea level of 25 mm per decade in Hong Kong. Our analysis also indicates a significant increase in daily heavy rainfall intensity. Furthermore, in 14.54 % of cases, extreme storm surges coincided with heavy rainfall, while 13.69 % of heavy rainfall events occurred alongside extreme sea level conditions. The copula-based joint analysis reveals significant positive correlations among these extreme events. Our findings further reveal that the return level for a 100-year heavy rainfall event increases dramatically from 126.36 mm in the univariate case to 261.16 mm in the trivariate scenario, underlining the escalated risk associated with compound flooding. Similarly, for storm surge extremes, trivariate analysis reveals elevated risk during compound flood events, with the return level rising from 1.18 m (univariate scenario) to 1.40 m (trivariate scenario) for a 100-year return period. These spatial–temporal maps and comprehensive compound flood risk assessments offer crucial insights for addressing the multi-hazard flood risk in coastal urban areas.