Massive stars play an important role in shaping the structure of giant molecular clouds and even of their host galaxies as a whole. Their powerful stellar winds and copious UV radiation fields dominate the momentum and energy budget of the interstellar medium. Only a few million years after their formation, massive stars explode as supernovae or gamma-ray bursts (GRB), leaving a neutron star or a black hole. Thus, massive stars trace the current episodes of star formation in a galaxy, and so far provide the only measure of star formation at cosmological distances. I will present new results obtained with X-shooter on the ESO Very Large Telescope related to the formation of massive stars in the Galaxy, the properties of massive stars in low-metallicity environments in Local Group galaxies, and some highlights from our ongoing GRB follow-up program. I will end with a future perspective on the study of massive stars with the ESO Extremely Large Telescope.