Daiki Hashimoto propelled Japan to Olympic men's team gymnastics gold as arch-rivals China stumbled with the title within their grasp.
Japan's record-extending eighth team title made up for their failure to win gold at the Tokyo Games. China took silver and the United States bronze.
Bossing the qualifying, China only had to hold their nerve in the last of the six rotations for victory. But Su Weide fell twice on the horizontal bar, leaving Japan an unexpected opening.
In a nail-biting finish at Bercy Arena, Hashimoto, the Tokyo 2020 all-around and horizontal bar champion, finally hit form. The 22-year-old's superb performance got Japan home by just 0.532 points with an overall points tally of 259.594. "I had a lot of things on my mind, but when I got onto the stage, I just concentrated on my performance," Hashimoto said.
A downcast Zhang Boheng said: "We are frustrated. Up to then we have done very well."
The Chinese took the lead at the midway stage after Zou Jingyuan, Zhang and Liu Yang showed cast-iron crosses and assured handstand control on the rings. Japan were lagging in fifth.
Zou had produced a huge 16.000 score on the parallel bars to push China over three points clear, ahead of the closing rotation. But Hashimoto's herculean effort - combined with Su's two faux pas - ultimately earned Japan gold.
"Today taught me a big lesson, it's of great regret," Su said.
AGENCE FRANCE-PRESSE
Su Weide's falls from the bar cost China. AP, XINHUA
Daiki Hashimoto is mobbed after his heroics for Japan. AP