The Tunisian surged ahead as soon as he got within the ropes outlining the finish area.
"I was hoping they wouldn't stay with me," Mellouli said. "Once I put the jets on I was able to take off, finish the race and take the win."
As easy as that.
Mellouli clocked 53 minutes, 30.4 seconds. Eric Hedlin of Canada took silver, 1.2 seconds behind, and five-time world champion Thomas Lurz of Germany finished third, 1.8 back.
Including the open water worlds, Lurz had won the 5km title seven consecutive times but he couldn't match Mellouli's sprinting.
"It's ok, I'm 33-years-old and I started working again in January," Lurz said. "I knew in the last 50m I would not win. (Mellouli) swims the 100m freestyle five seconds faster than me or more. This is the problem."
Mellouli won the 10km and took bronze in the 1 500m freestyle at last year's London Games to become the first swimmer to win medals in both the pool and open water at the same Olympics. And he won the 1 500m at the 2008 Beijing Games.
The 29-year-old Mellouli had planned to retire after the London Games but he changed his mind a couple of months later, and only began training again six months ago.
"This year was supposed to be a year off for me," he said. "So to come back here after a solid two months of training and to be on top of the world is quite exciting for me."
If there were questions over his form ahead of this race, Mellouli is now clearly the favorite for Monday's 10km.
"I'm just going to celebrate the 5km and worry about the 10km after a day off tomorrow," he said.
"It's definitely a boost of confidence. It doesn't hurt to win the 5km going into the 10km, that's for sure."
Mellouli is also entered in three pool events - the 400m, 800m and 1 500m freestyle - but won't decide on those races until after the open water events. He trains at the University of Southern California with women's 5km winner Haley Anderson of the United States.
"It's a great job for the Trojans today," he said, thanking his American coaches Catherine Vogt, Jon Urbanchek and Dave Salo. "It's an awesome group."
Mellouli also attended an altitude training camp with Michael Phelps' former coach, Bob Bowman, in Colorado Springs, Colorado, six weeks ago.
While Mellouli had criticised the water as dirty in training earlier in the week following a rainstorm that appeared to spread pollution, he had no complaints after winning.
"Conditions were great," he said. "The water cleaned up a lot. I'm really happy with the venue."
Midway through the race, Fernando Sevilla Garcia of Mexico was disqualified for failing to swim around a buoy.
The race took place in ideal sunny conditions, with the water 24 degrees Celsius and the air temperature about 30 Celsius. With the course right along the docks, fans watching from the shore had a great view.
Results on Saturday from the FINA Swimming World Championships:
Open Water Swimming
Men's 5km
1. Oussama Mellouli, Tunisia, 53 minutes, 30.4 seconds
2. Eric Hedlin, Canada, 53:31.6
3. Thomas Lurz, Germany, 53:32.2
4. Chad Ho, South Africa, 53:33.7
5. Jarrod Poort, Australia, 53:34.3
6. Samuel De Bona, Brazil, 53:34.9
7. Ivan Alejandro Enderica Ochoa, Ecuador, 53:36.7
8. Sergey Bolshakov, Russia, 53:36.8
9. Damien Cattinvidal, France, 53:38.4
10. Igor Chervynskiy, Ukraine, 53:38.4
Women's 5km
1. Haley Anderson, United States, 56 minutes, 34.2 seconds
2. Poliana Okimoto, Brazil, 56:34.4
3. Ana Marcela Cunha, Brazil, 56:44.7
4. Kalliopi Araouzou, Greece, 56:45.3
5. Isabelle Franziska, Germany, 56:46.2
6. Cara Baker, New Zealand, 56:46.2
7. Martina Grimaldi, Italy, 56:46.3
8. Becca Mann, United States, 56:46.4
9. Aurelie Muller, France, 56:46.5
10. Rachele Bruni, Italy, 56:48.1