It's the 34-year old's 6th gold medal of his World Championships career.
Despite doping allegations against him prior to the race, Farah survived a collective effort from his rivals to claim victory, as his family joined him on the track to celebrate afterwards.
He added: "It was awesome tonight, I had to get my head around it".
Farah will now hope to complete yet another long-distance double - the feat he has completed at the last four global championships - with victory in next week's 5000m.
"On encouraging the crowd: "I just wanted to play with the guy's head". It wasn't an easy race.
"I knew at 12 laps to go when they went hard from there it was going to be tough".
Since missing out on gold by a hair's breadth in Daegu in 2011, after Ibrahim Jeilan unleashed one of the greatest ever final laps, Mo Farah has won world doubles in 2013 and 2015 and Olympic doubles in 2012 and 2016. I miss spending time with them (my family).
The Londoner was the first British woman to run under 11 seconds and won Olympic bronze as part of the 4x100m relay team last summer. No runner has ever achieved that - not Kenenisa Bekele (four, with Olympic and World Championship doubles in 2008-09), not Haile Gebrselassie (six at 10,000m, but no double wins), not Lasse Viren (four at Olympic level in pre-World Championships days), not Emil Zatopek, not Paavo Nurmi.
Heats for the women's 200m will begin at 19:30 on Tuesday, there will then be semi-finals on Thursday before the final on Friday night.
McDonald scraped through as a fastest loser after finishing ninth, with a personal best of 4mins 05.48 secs, in the third heat at the London Stadium.
Mo Farah has said that the 3,000m at the Birmingham Grand Prix on August 20 will be his last race on the track in Britain. That is the highlight of my year, my life, it was just fantastic. I didn't expect to go off that hard, I couldn't hear myself breathe. I've got such a long stride I got caught twice and at that point I was just trying to stand up.
For once then it seemed Usain Bolt was playing support act, his qualification from the 100m heats a little earlier merely teasing the crowd for what is to come.
Prescod said: "My first World Championships I come out with a PB in the first round - I can't really complain".
Meanwhile, Nick Percy failed to reach the discus final but Holly Bradshaw reached the pole vault final.