The imperious Jamaican, who has struggled with injury all season, surged home in 9.79 seconds
edging Gatlin, the fastest man in the world this year, into silver medal position just one hundredth of a second back.
Bronze was shared between youngsters Andre De Grasse and Trayvon Bromell who finished with an identical time of 9.92 seconds.
"This means a lot because I've been struggling all season," Bolt told BBC Sport immediately after the race. "It's taken me a while to work things out. It's been up and down but it's okay now."
Although Bolt's winning 9.79 was a season's best, it remained down on the 9.77 clocked by Gatlin in the semifinals earlier in the day.
The pair were neck and neck after 80m but Gatlin seemed to loose his balance as he approached the finish line leaving Bolt to savor yet another big-stage victory.
Battle for the soul of athletics
It was a fittingly dramatic end to one of the most talked about 100m events in years.
The final had been billed, somewhat melodramatically, as the battle for the soul of athletics. While double Olympic 100 meter champion and "fastest man ever" Bolt has never failed a drugs test, Gatlin has twice been banned for substance misuse.
The new head of the IAAF, Seb Coe, even went as far to say that he felt "queasy" at the prospect of Gatlin, himself a former world record holder and Olympic gold medalist in Athens 2004, defeating the iconic "Lightning Bolt."
Coe's concerns were not eased by recent allegations of mass doping within athletics or the fact that three other men in the Sunday's final -- Mike Rodgers, Tyson Gay and Asafa Powell, who finished fifth, sixth and seventh respectively -- have also served drug bans.
Speaking about the pre-race hype and concerns surrounding doping, Bolt said: "for me I understand why (there was a focus on drug taking) but I wanted to do it for myself also."
Returning from the poor form and the pelvic injury that has hampered this year to win "was a big deal," he added.
Beating the form book
Yet such a satisfying triumph for the 29-year-old appeared a long way off just a couple of hours earlier.
Bolt only just scraped into the final after stumbling at the start of his semifinal heat before being forced to turn on the afterburners just to catch up with the rest of the field.
Then there was the imperious form of Gatlin, the man he was competing for gold with.
Although Bolt had won six of the seven races between the pair over the years, Gatlin was unbeaten in 28 races and boasted the fastest time (9.74 seconds) of any sprinter this year.
While Bolt still holds the world record at 9.58 seconds, a feat achieved at the World Championships in Berlin six years ago, his fastest time in 2015 before the final was 0.13 seconds slower than Gatlin.
Bolt had sought to play down concerns that he has been struggling to maintain his own high standards, calmly telling reporters he was in "wonderful condition" after Saturday's heats.
Truth be told, he sounded and looked far from his brash convincing self.
After another momentous Beijing victory on the very track where he claimed three Olympic gold medals in 2008, however, there will be few who ever doubt the great man again.