Energy and environment ministers from the Group of Seven (G7) economically advanced nations, including the United States, agreed to ramp up electricity generated by renewable energy sources to accelerate the transition away from fossil fuels.

Yet the ministers, recognizing global demand shifts amid Russia’s war in Ukraine and the particular energy needs of meeting host country Japan, paved a path for continued investment in natural gas during a transition projected to reach a pinnacle in 2050.

The countries have committed to reaching net-zero emissions by mid-century, in large measure by phasing out fossil fuels. But G7 leaders noted that, since the onset of Russia’s invasion in February 2022, the Kremlin has cut off the bulk of gas delivered to Europe via pipeline. This...