The paper presents the development and implementation of automatic operation and control for a pump/hydrocyclone produced water- treatment system to maximize oil/water-separation efficiency. A so-called perturb-and-observe (P&O) algorithm is adapted for a novel centrifugal pump to continuously optimize the point of operation. The novel pump coalesces and increases the size of oil droplets in the produced water, resulting in a unique relationship between the coalescing effect and the point of operation, and allowing for the successful implementation of the P&O algorithm. The algorithm was implemented in two different setups, one measuring the droplet size distribution between the hydrocyclone and the pump, and the other measuring the oil concentration downstream of the hydrocyclone. The latter was considered the most robust because it required no prior knowledge of the system. Nonetheless, both setups achieved satisfying results and compared favorably with a third setup, where the optimal point of operation was predicted using measurements of the upstream produced-water characteristics.