Wastewater treatment is carried out in plants using a complex series of biological, physical, and chemical processes. Typically, these plants operate in a conservative and inefficient risk-averse mode that makes it difficult to quantify the risks or truly minimize the costs. We developed an innovative operational control process that applies descriptive, predictive, and prescriptive analytics to improve efficiency and reduce costs. The descriptive analytics use historical sensor data to build a simulation model and plantstate estimator. The predictive analytics model the wastewater treatment process behavior using a transition probability matrix, which we estimated. Finally, our prescriptive Markov decision process analytics offer recommendations for improved operations. We deployed our system at a plant in Lleida, Spain. The results of the pilot showed a dramatic 13.5% reduction in the plant's electricity consumption, a 14% reduction in the amount of chemicals needed to remove phosphorus from the water, and a 17% reduction in sludge production.