Bolt, who had to settle for bronze in the individual 100 metres, had been hoping to sign off from the sport by leading Jamaica to a fifth successive relay gold but they were struggling in third place when he collected the baton.
As he tried to gain ground, Bolt pulled up and fell to the floor with what looked like a hamstring injury.
The 60,000 in the stadium who had come to mark the farewell sport's greatest showman had only a split second to absorb what was happening as up ahead a new chapter was being written.
The U.S., with individual gold and silver medallists Justin Gatlin and Christian Coleman running the second and fourth legs, had been expected to push the Jamaicans all the way but they were always trailing the slick Britons.
The brilliantly executed race by Chijindu Ujah, Adam Gemili, Danny Talbot and Nethaneel Mitchell-Blake gave Britain gold in 37.47 seconds, breaking an 18-year-old national record, and the world title for the first time.
"I wasn't sure if I had won or not, I gave it my all but I could see Christian Coleman out of the corner of my eye," said Mitchell-Blake.
"The feeling of euphoria was from infinity. I can't register it. We smashed the British record to pieces."
Britain's only other men's global sprint relay golds came in the 1912 and 2004 Olympics.
It completed a great night for the host nation's sprinters after their women had earlier taken silver behind the Americans in the sprint relay, their best performance since the first championships in 1983.
The U.S. men took silver in 37.52 but for a nation that used to be totally dominant in the event, it was only their second medal in the last eight global finals after a series of world championship and Olympic disqualifications.
Japan took advantage of Jamaica's travails to take third in 38.04.