The Hubble tension refers to the discrepancy in the value of the Hubble constant H0 inferred from the cosmic microwave background and the supernovae observations. In order to alleviate this tension, we propose a modification to the standard ΛCDM model by replacing the cosmological constant Λ with a dynamical scalar field in the framework of Horndeski gravity, which drives the late time accelerated expanding phase of the Universe. With a combination of the G4 and G5 terms of the Horndeski Lagrangian, we show that, it is possible to construct viable scenarios for alleviating the Hubble tension which are free from gradient and ghost instabilities and the superluminal propagation of the scalar and tensor perturbations. Working with two different classes of scalar field potentials and with appropriate choices of model parameters, we exhibit that one can obtain a large enough value of H0, so as to be consistent with the late Universe observations. Since these modifications are extremely small at early times, the corresponding deviations from the ΛCDM cosmology are completely negligible at high redshifts.