Here, we present an improved water quality index (WQI) model for assessment of coastal water quality using Cork Harbour, Ireland, as the case study. The model involves the usual four WQI components – selection of water quality indicators for inclusion, sub-indexing of indicator values, sub-index weighting and sub-index aggregation – with improvements to make the approach more objective and data-driven and less susceptible to eclipsing and ambiguity errors. The model uses the machine learning algorithm, XGBoost, to rank and select water quality indicators for inclusion based on relative importance to overall water quality status. Of the ten indicators for which data were available, transparency, dissolved inorganic nitrogen, ammoniacal nitrogen, BOD5, chlorophyll, temperature and orthophosphate were selected for summer, while total organic nitrogen, dissolved inorganic nitrogen, pH, transparency and dissolved oxygen were selected for winter. Linear interpolation functions developed using national recommended guideline values for coastal water quality are used for sub-indexing of water quality indicators and the XGBoost rankings are used in combination with the rank order centroid weighting method to determine sub-index weight values. Eight sub-index aggregation functions were tested - five from existing WQI models and three proposed by the authors. The computed indices were compared with those obtained using a multiple linear regression (MLR) approach and R2 and RMSE used as indicators of aggregation function performance. The weighted quadratic mean function (R2 = 0.91, RMSE = 4.4 for summer; R2 = 0.97, RMSE = 3.1 for winter) and the unweighted arithmetic mean function (R2 = 0.92, RMSE = 3.2 for summer; R2 = 0.97, RMSE = 3.2 for winter) proposed by the authors were identified as the best functions and showed reduced eclipsing and ambiguity problems compared to the others.