Spatio-temporal prediction has a wide range of applications in many fields, e.g., air pollution, weather forecasting, and traffic forecasting. Water quality prediction is also one of spatio-temporal prediction tasks. However, it faces the following challenges: 1) Water quality in river networks has complex spatial dependencies; 2) There are complex nonlinear relations in water quality time series; and 3) It is difficult to realize long-term forecasting. To address these challenges, this work proposes a spatio-temporal prediction model called a Graph Attention-based Spatio-Temporal (GAST) neural network. GAST investigates spatial and temporal dependencies of water quality time series. First, we introduce a temporal attention mechanism to capture time series dependencies, which can effectively handle nonlinear relationships in time series. Second, we adopt a spatial attention mechanism to extract spatial dependencies of river networks and fuse temporal features of spatial nodes. Third, we adopt a temporal convolution residual mechanism based on the spatio-temporal fusion, which improves the accuracy of long-term series prediction. This work adopts two real-world datasets to evaluate the proposed GAST and experiments demonstrate that GAST outperforms several state-of-the-art methods in terms of prediction accuracy.