Louis Smith, Max Whitlock, Daniel Purvis, Sam Oldham and Kristian Thomas scored a total of 271.711 as they produced a stunning team performance in front of a royal audience.
Britain had initially been awarded silver but an inquiry into the score of Kohei Uchimura's Pommel Horse routine saw Japan claim silver and Great Britain downgraded to bronze.
China retained their gold medal with 2008 silver medallists Japan leapfrogging Britain's score of 271.711 with an upgraded total of 271.952.
The Duke of Cambridge and Prince Harry led the support as Britain won their first Olympic Team medal since the bronze at the Stockholm Games in 1912 to thunderous applause from the Host Nation crowd.
A medal of any colour would have exceeded all expectations for the British team and bronze had looked like the best they could aim for against the powerhouses of the United States, Russia, China and Japan.
In a tense finale, it looked as if they had done enough to secure the bottom step on the podium after going head-to-head with Ukraine on the last piece of apparatus as the USA faded away.
Ukraine were in bronze medal position and Japan in silver with the final rotation to go, but brilliant performances on the floor by Whitlock, Purvis and Thomas saw them seal their place on the podium, as Japan faltered and finished in fourth.
However, there was a twist in the tale, as Japan launched an inquiry into three-time world champion Uchimura's score, leaving Britain waiting to learn their fate.