•Diameter and shape-controlled Mg nanoflowers were synthesized by one-pot method •pH-sensitive Mg nanoflower was prepared for cancer therapy •Acidic TME could trigger the reaction of Mg nanoflowers and water to generate H2 •Mg nanoflowers can serve as an excellent NIR-II PAI and USI contrast agent Metallic magnesium is a promising platform for H2 cancer therapy, whereas the available Mg particles’ undesirable diameter and shape greatly hinder its therapeutic application. Herein, we first reported the diameter- and shape-controlled synthesis of Mg nanoparticles, including hexagonal nanosheet (∼80–320 nm), nanoflower (∼100–250 nm), and small nanoparticle (mean 65 nm), by a one-pot method. As a proof of concept, pH-sensitive polymer-coated Mg nanoflowers were prepared and applied in NIR (near infrared)-II photoacoustic and bubble-enhanced ultrasound imaging and cancer therapy. It continuously generated H2 in the tumor because the acidic tumor environment triggered the disassembly of the polymeric shell, leading to the reaction of Mg and water. The generated H2 bubbles not only induced transient cavitation and mechanically ruptured lysosomes but also disturbed the cellular energy metabolism and induced high oxidative stress simultaneously, leading to cancer-cell death. Thus, this drug-free therapy method presented superior synergistic tumor inhibition effects. Metallic magnesium is a promising platform for H2 cancer therapy, whereas the available Mg particles’ undesirable diameter and shape greatly hinder its therapeutic application. Herein, we first reported the diameter- and shape-controlled synthesis of Mg nanoparticles, including hexagonal nanosheet (∼80–320 nm), nanoflower (∼100–250 nm), and small nanoparticle (mean 65 nm), by a one-pot method. As a proof of concept, pH-sensitive polymer-coated Mg nanoflowers were prepared and applied in NIR (near infrared)-II photoacoustic and bubble-enhanced ultrasound imaging and cancer therapy. It continuously generated H2 in the tumor because the acidic tumor environment triggered the disassembly of the polymeric shell, leading to the reaction of Mg and water. The generated H2 bubbles not only induced transient cavitation and mechanically ruptured lysosomes but also disturbed the cellular energy metabolism and induced high oxidative stress simultaneously, leading to cancer-cell death. Thus, this drug-free therapy method presented superior synergistic tumor inhibition effects.