Gatlin, who has served two doping bans and won silvers behind Bolt at the last two world championships, clocked 9.92 seconds, with teammate Christian Coleman winning silver in 9.94sec.
Bolt suffered a dreadful start and could only claim bronze in 9.95sec.
“I’m sorry I couldn’t end it on a winning note, but I want to thank you for your support,” said Bolt, who embraced Gatlin after they streaked through the line with no clear victor immediately apparent.
“It’s been a wonderful experience as always.”
Gatlin was afforded the same rough reception as he had in the heats and semi-finals, loud boos and jeering ringing around the same stadium where in 2012 his rivalry with Bolt was presented as ‘good against evil’, given the American’s doping-tainted past.
“I tuned it out (the boos) through the rounds and stayed the course,” said Gatlin.
“I did what I had to do. The people who love me are here cheering for me and cheering at home.
“It is Bolt’s last race. I have had many victories and many defeats down the years. It is an amazing occasion. We are rivals on the track but in the warm-down area we joke and have a good time.”
The jeering did indeed continue unabated after it became clear Gatlin, a sprinter whose past divides track and field, had gatecrashed Bolt’s party.
Gatlin initially put his finger to his pursed lips as if to hush the crowd, before dropping to his knees to bow down to Bolt.
“The first thing he did was congratulate me and say that I didn’t deserve the boos. He is an inspiration,” Gatlin said of Bolt.
Coleman added: “It was an historic moment for me to beat Bolt who has taken this sport to another level and who I watched as I grew up. A humbling experience.
“I’m delighted for Justin as we have bonded and become close. I was impressed by the way he handled the pressure and the crowd.”
Gatlin has form as the last man to beat Bolt over 100m — by a hundredth of a second in Rome in 2013 — and at the age of 35, can still produce the goods, something he has in the past ironically credited with his four years of forced exile from the track.
The evening was all supposed to be about the 30-year-old Bolt claiming a remarkable 12th world gold to add to his eight Olympic golds in what has been a glittering career.
And what a gaping hole his absence will leave, no matter how brave a face track and field’s governing body the IAAF try to put on it.
Of his 19 global golds, 13 have come in individual events and allied with a charismatic personality, it has guaranteed Bolt recognition as one of the world’s most successful sportsmen.
– Kingston in Stratford –
“It feels like most of Kingston is in Stratford tonight,” the stadium announcer said of the welcome afforded Bolt in the eastern London stadium now home to West Ham United in the English Premier League.
In temperatures of 19 degrees Celsius (68F), Bolt the showman demonstrated exactly what athletics will miss when he bows out.
The sell-out 60,000 crowd roared as he entered the stadium to do his final warm-up on the track.
Stripped to a vest and tight shorts in the black, green and yellow of Jamaica, chants of “Usain Bolt” rang around in a surprisingly tense atmosphere.
Gatlin, on the other hand, was emotionless as loud jeers welcomed him.
Starting in lane four, Bolt was incredibly slow to react out of the blocks, the 100 and 200m world record holder behind Coleman in the lane outside from the off.
The crowd, on their feet, roared, and so Bolt responded as he has so many times before.
After 50 metres, he moved into his famed “drive phase”, head coming slowly up as part of the process that unleashes the full power from his long legs. But it was not quite enough.
Teeth gritted and eyes glued on the big screen of the Trevor Brooking Stand, Bolt streaked through the finish line but any fairytale individual finish to a startling career was dashed by Gatlin and young pretender Coleman.
For the IAAF, could there have been a worse outcome?
Russia remains banned from international competition over doping and now their prized athlete, destined for some kind of future ambassadorial role within the body, bows out beaten by a two-time, largely unrepentant drugs cheat.