The Briton, rocked this season by doping allegations against his coach, put the row behind him as he produced a devastating final 80 metres to romp home in 13min 50.38sec.
Kenyan Caleb Ndiku, in 13: 51.75, held on for silver after making a valiant break with 800m to run. Ethiopian Hagos Gebrhiwet took bronze.
The victory for Farah, who won the 10,000m on the opening weekend, seals a unique "triple double" of distance titles at consecutive world championships and the London Olympics.
"It's difficult as everybody has got great speed and there are a lot of guys capable of winning. They went for it. The important thing was to win the race and I did that!"
More From This Section
Farah's victory gave him an unprecedented seventh successive distance win at world championships and Olympics, stretching back to his 5,000m gold at Daegu in 2011.
His double matched that of sprinter Usain Bolt, with whom Farah came through youth and junior ranks, after the Jamaican successfully defended his 100m and 200m titles.
Farah parked himself at the back of the pack as American pair Ben True and Galen Rupp, Farah's training partner under embattled coach Alberto Salazar in Oregon, followed Farrell.
With seven laps to run, Farah started moving up the field, having to push veteran Imane Merga in the back and onwards as the Ethiopian also harried his way past and into the lead.
Farah settled back into his stride as the peloton massed close together again, Merga's surge easily absorbed.
The real kick came with 800 metres to run, Ndiku stretching out the field for the first time with an impressive turn of pace.
As the bell for the final lap rang, the Commonwealth champion and reigning world indoor 3000m gold medallist from Kenya remained at the front, chased by Farah and Gebrhiwet at full tilt.
Farah failed to catch the Kenyan around the bend, but coming into the final straight, the Londoner rounded Ndiku to roars from a packed crowd with an amazing turn of speed for an ultimately comfortable victory. Ethiopian Yomif Kejelcha, the world's fastest performer in 2015, came in fourth ahead of Rupp and True.