Japan stunned Wales in Kitakyushu with a first-Test fightback that condemned the visitors to an 18th successive defeat.
The tourists led 19-7 at the break in extreme hot and humid conditions in a marathon match.
But Japan scored all the second-half points with Halatoa Vailea crashing over from a close-range line-out in the 71st-minute to claim the win for Eddie Jones' side.
After losing lock Ben Carter to injury after only 24 seconds, took the initiative through tries from from Ben Thomas, Tom Rogers and a penalty try, but faded badly in the searing heat.
Japan, inspired by 36-year-old captain Michael Leitch, claimed victory through tries from Takuro Matsunga, Ichigo Nakakusu and Vailea with nine points from the boot of Seungsin Lee.