It was the seventh event out of the 98 contested at the Sochi Games in which all three medals were won by competitors from the same nation.
In one of the most grueling contests in all of sports, Legkov skied under sunny skies and mild temperatures to a time of 1:46.55.2.
He took part in a thrilling finish among four skiers -- two of them his teammates and the other from Norway.
The Norwegian, Martin Johnsrud Sundby, was the one shut out of the medals.
Legkov won by seventh-tenths of a second over Maxim Vylegzhanin. Ilia Chernousov finished another tenth of a second behind with Sundby winding up exactly one second back.
A look at the photo from the finish line was needed to determine the silver-medal winner.
It was a virtual certainty going into the final day of the Olympics that Russia would win the race for overall medals and the cross-country race ensure that.
Russia also clinched first place in the gold medal chase with Legkov's victory.
Kegkov made a strong move during the second half of the race. At the 35-kilometer checkpoint he was in fifth placer, 25 seconds behind. During the next five kilometers he caught up to the lead pack and stayed there until the blanket finish.
Speed skaters from the Netherlands were involved in four medal sweeps at these Olympics. Both the United States and France had a sweep in freestyle skiing.