Jamaica's quartet clocked 36.84 seconds, smashing the old mark by two-tenths of a second and leaving the United States with silver.
Nesta Carter and Michael Frater produced excellent first and second legs but it was 100m and 200m silver medallist Yohan Blake's blistering third leg that set the platform.
Bolt provided the perfect finale - exploding away to leave Ryan Bailey trailing as the capacity crowd stood to acclaim him.
Canada were initially given bronze before being disqualified when third-leg runner Jared Connaughton stepped outside of his lane, meaning Trinidad and Tobago were promoted to third place.
After winning the  and  in Beijing 2008 and London 2012, plus the 4x100m relay, the latest gold means Bolt now has six Olympic golds before his 26th birthday.
"It was electric. The atmosphere in the stadium was electric and it was all because of this race. The big difference was when Blake received the baton he tore around the bend - and he was up against Tyson Gay! Usain Bolt was watching that clock all the way down the home straight."
It was a fitting way to conclude a wonderful nine days of athletics in the Olympic Stadium.
Bolt said London 2012 had been "amazing" and on the race added: "It's a wonderful feeling to end on a high note. It was a great championships, I'm happy, the team came out and gave it their all, I wish we could have gone faster but we leave room for improvement."
He said he did not know if he would be aiming for a third treble gold haul in Rio 2016: "It's going to be hard. Yohan is running hard and I'm sure there's going to be more young cats coming up."
Usain Bolt celebrated with a "Mobot" as he crossed the line, paying tribute to Britain's 5,000m and 10,000m double Olympic champion, Mo Farah.
Usain Bolt won his third gold medal of the 2012 Olympics as he anchored Jamaica's sprint relay team to a sensational world record.