The water quality of the Pearl River Estuary (PRE) is vulnerable to human activities and natural factors, presenting excessive inorganic nitrogen (IN) and reactive phosphate (RP). Timely and accurate water quality prediction is challenging due to the complex controlling factors therein. This study developed a machine learning framework for spatiotemporal water quality prediction, as well as the derived proportion of excellent/good (Classes Ⅰ or Ⅱ) water quality (Aq). The framework considered sea surface salinity as a key proxy of ocean dynamics from a previously developed machine learning, as well as riverine pollutant fluxes from a watershed model, pollutant loads from empirical estimations, and invariant variables (water depth and geographic information). Since training data is limited and discrete spatiotemporally, a transfer learning strategy was applied: the framework was initially pre-trained with numerical simulations and then fine-tuned with the optimal interpolation from observations. Validation shows good model generalization (86.04% accuracy for IN and 81.69% for RP). The framework projects an improving tendency of the PRE water quality in the near future (2023-2025). Furthermore, the SHapley Additive exPlanations (SHAP) analysis identified critical areas and recommended regulatory measures for marine environment management.