This study presents a new method called optimally pruned extreme learning machine (OP-ELM) for forecasting dissolved oxygen concentration (DO) several hours in advance. The forecast time horizon ranges from 24-h ahead (one day) to 168-h ahead (seven days). The proposed OP-ELM model is compared to the standard multilayer perceptron neural network (MLPNN) with respect to their capabilities of forecasting DO in the Klamath River at Miller Island Boat Ramp, Oregon, USA. To demonstrate the forecasting capability of OP-ELM and MLPNN models, we used a long-term data set of hourly DO data for a ten-year period, from 1 January 2004 to 31 December 2013, collected by the United States Geological Survey (USGS Stations No: 420,853,121,505,500 [Top] and 420,853,121,505,501 [Bottom]). For developing the models, we split the data set into a training subset (from 2004 to 2010) that corresponded to 70 %, and a validation (from 2011 to 2013) that corresponded to 30 % of the total data set. We investigated the performance and accuracy of the proposed two models for three different horizons, i.e., short-term, medium-term and long-term forecasting; a total of six different models (FM1 to FM6), having the same data sets as inputs, were developed for short-term (24 h to 48 h), medium-term (72 h to 96 h) and long-term (120 h to 168 h) horizons. Input variables used in the six models were the six antecedent DO concentrations at (t-5), (t-4), (t-3), (t-2), (t-1) and (t). The performance of the OP-ELM and MLPNN models in training and validation sets were compared with the observed data. To get more accurate evaluation of the results of the two models, the following seven statistical performance indices were used: the coefficient of correlation (R), the Willmott index of agreement (d), the Nash-Sutcliffe efficiency (NSE), the root mean squared error (RMSE), the mean absolute error (MAE), the bias error (Bias), and the mean absolute percentage error (MAPE). The study reveals that OP-ELM and MLPN provided good results and they were successful in forecasting DO at a high level of accuracy. The reliability of forecasting decreased Environ. Process. with increasing the step ahead. The measures of model performance fell within the acceptable ranges for the two stations. Regarding the fact that researches on medium and long-term forecasting are relatively limited, the present work aims to build and provide a good early warning system capable of preventing DO depletion and the associated problems of anoxia and hypoxia in river. Furthermore, the proposed forecasting models, when implemented appropriately, could be reliably used in detecting future change in DO concentration in rivers.