The dynamic positioning (DP) system is responsible for the station keeping of vessels in several offshore operations. The forces required by the DP system are distributed among the available thrusters by a thrust allocation algorithm which should be accurate, efficient and robust. This means that the effective forces match the required forces whilst power consumption is minimized. Additionally, in case of impossibility of generating the required forces, the heading of the vessel is maintained to avoid increasing environmental forces. To accurately generate the required forces, the physical limitations of the thrusters and the hydrodynamic interactions must be considered. The hydrodynamic interactions are consistently modelled to accommodate the following typical effects: thruster–hull, thruster–current and thruster–thruster interaction. The result of this modelling is a non-linear optimization problem, which is solved using the sequential quadratic programming (SQP) algorithm with slack variables. The slack variables relax the problem and allow deciding in which direction the error should be minimized. Altogether, the developed thrust allocation algorithm presents better station keeping capability, due to precise force generation and optimized power consumption. Furthermore, the behaviour of the thrust allocation algorithm on harsh sea prevents the increase of environmental forces, which leads to safer offshore operations.