Brazil's Arthur Zanetti stunned Chinese defending champion Chen Yibing to claim victory in the men's still rings final on Monday and give his country their first ever Olympic gymnastics gold.
Chen looked set for gold after posting a score of 15.800 points, but Zanetti upset the odds with a final routine that earned him 15.900, while Italy's Matteo Morandi took the bronze medal.
"I'm very happy," said Zanetti. "I was the last gymnast to compete and I stayed calm and took my moment.
"It's the very first Olympic medal for Brazil in gymnastics, so I'm really happy with this."
Zanetti, 22, owed his victory to an execution score of 9.100, which was 0.100 points better than Chen's.
Prior to his success in Monday's final at the North Greenwich Arena, Zanetti's greatest achievement was a silver medal behind Chen at last year's world championships in Tokyo.
His triumph gave Brazil their second gold medal of the London Games, and their eighth medal in total.
Four-time world rings champion Chen had been bidding to win his fourth Olympic gold, having claimed two golds in Beijing four years ago and helped China to team gold in London on July 30.
Chen was the first man to take to the apparatus and he produced a faultless routine matched by a perfect landing, breaking into a broad grin as he did so.
He was a picture of calm thereafter, sitting on the sidelines with headphones in his ears, only for Zanetti to dash his hopes of a successful title defence by snatching victory with the last display of the final.
Bulgaria's Jordan Jovtchev, 39, made history by becoming the first male gymnast to appear at six Olympic Games but he missed out on a medal after falling to his knees on landing.