Context. Mass loss through radiatively line-driven winds is central to our understanding of the evolution of massive stars in both single and multiple systems. This mass loss plays a key role in modulating massive star evolution at different metallicities, especially in the case of very massive stars (M* ≥ 25 M⊙). Aims. Here we present evolutionary models for a set of massive stars, introducing a new prescription for the mass-loss rate obtained from hydrodynamical calculations in which the wind velocity profile, v(r), and the line-acceleration, gline, are obtained in a self-consistent way. These new prescriptions cover most of the main sequence phase of O-type stars. Methods. We made a grid of self-consistent mass-loss rates Ṁsc for a set of standard evolutionary tracks (i.e. using the old prescription for mass-loss rate) with different values for initial mass and metallicity. Based on this grid, we elaborate a statistical analysis to create a new simple formula for predicting the values of Ṁsc from the stellar parameters alone, without assuming any extra condition for the wind description. Therefore, replacing the mass-loss rates at the main sequence stage provided by the standard Vink’s formula with our new recipe, we generate a new set of evolutionary tracks for MZAMS = 25, 40, 70, and 120 M⊙ and metallicities Z = 0.014 (Galactic), Z = 0.006 (LMC), and Z = 0.002 (SMC). Results. Our new derived formula for mass-loss rate predicts a dependence Ṁ ∝ Za, where a is no longer constant but dependent on the stellar mass: ranging from a ∼ 0.53 when M* ∼ 120 M⊙, to a ∼ 1.02 when M* ∼ 25 M⊙. We find important differences between the standard tracks and our new self-consistent tracks. Models adopting the new recipe for Ṁ (which starts off at around three times weaker than the mass-loss rate from the old formulation) retain more mass during their evolution, which is expressed as larger radii and consequently more luminous tracks over the Hertzsprung-Russell diagram. These differences are more prominent for the cases of MZAMS = 70 and 120 M⊙ at solar metallicity, where we find self-consistent tracks are ∼0.1 dex brighter and retain up to 20 M⊙ more than with the classical models using the previous formulation for mass-loss rate. Later increments in the mass-loss rate for tracks when self-consistency is no longer used, attributed to the LBV stage, produce different final stellar radii and masses before the end of the H-burning stage, which are analysed case by case. Moreover, we observe remarkable differences in the evolution of the radionuclide isotope 26Al in the core and on the surface of the star. As Ṁsc is weaker than the commonly adopted values for evolutionary tracks, self-consistent tracks predict a later modification in the abundance of 26Al in the stellar winds. This new behaviour could provide useful information about the real contribution of this isotope from massive stars to the Galactic interstellar medium.