It's the second medal of the London Games for Mellouli, who earned bronze in the 1,500-meter freestyle.
Men's Marathon Medal Winners
It's also the third career Olympic medal for Mellouli, who won gold in the 1,500 meters four years ago in Beijing. Although he wasn't able to defend that title, standing atop the podium for the marathon still makes it a successful Games for the 28-year-old swimmer.
The victory by Mellouli, who swam in college for USC, gives Tunisia its first gold medal of this year's Olympics and third overall. Thus, he's really carried the load for the nation, picking up two-thirds of the golds.
Thomas Lurz of Germany earned the silver.
It's the second straight time he's medaled in the event after winning bronze in 2008. He improved his time by nearly two seconds from that performance, which was necessary to finish in the top three.
Richard Weinberger rounds out the medal winners, picking up a bronze for Canada. The Olympic rookie had previously won marathon gold at last year's Pan American Games, putting him on track for the showing he had on Friday.
Greece's Spyridon Gianniotis was the only other swimmer within striking distance of the top three at the finish line. He crossed five seconds behind Weinberger, which isn't really much, considering that the race lasted nearly two hours.
No other swimmer finished within 30 seconds of the medal winners in one of the most grueling tests of endurance fans will witness at the Olympics.
Alex Meyer was the only American in the race. While the Minnesota native had a respectable 10th-place finish out of 25 competitors, he was 48 seconds behind Weinberger at the finish.
Meyer was actually in third place after the second lap, but he was unable to maintain that pace and eventually faded toward the middle of the pack. A strong final lap allowed him to move up to 10th.
The race brings an end to nearly two weeks of swimming events in London. The United States led all countries with 31 total medals, 16 of which were gold, followed by Japan with 11 and China and Australia with 10 each.
Mellouli's two medals tied with with big-name swimmers such as Chad le Clos and James Magnussen, a nice accomplishment for the Tunisian star.