The shipping industry is today increasingly concerned with challenges related with sustainability. CO $$:2$$ emissions from shipping, although they today contribute to less than 3% of the total anthropogenic emissions, are expected to rise in the future as a consequence of increased cargo volumes. On the other hand, for the 2 $$^\circ $$ C climate goal to be achieved, emissions from shipping will be required to be reduced by as much as 80% by 2050. The power required to propel the ship through the water depends, among other parameters, on the trim of the vessel, i.e. on the difference between the ship’s draft in the fore and the aft of the ship. The optimisation of the trim can, therefore, lead to a reduction of the ship’s fuel consumption. Today, however, the trim is generally set to a fixed value depending on whether the ship is sailed in loaded or ballast conditions, based on results performed on model tests in basins. Nevertheless, the on-board monitoring systems, which produce a huge amount of historical data about the life of the vessels, lead to the application of state of the art data analytics techniques. The latter can be used to reduce the vessel consumption by means of optimising the vessel operational conditions. In this book chapter, we present the potential of data-driven based techniques for accurately predicting the influence of independent variables measured from the on board monitoring system and the fuel consumption of a specific case study vessel. In particular, we show that gray-box models (GBM) are able to combine the high prediction accuracy of black-box models (BBM) while reducing the amount of data required for training the model by adding a white-box model (WBM) component. The resulting GBM model is then used for optimising the trim of the vessel, suggesting that between 0.5 and 2.3% fuel savings can be obtained by appropriately trimming the ship, depending on the extent of the range for varying the trim.