Four-time Olympic champion Mo Farah has won the final track race of his illustrious career, clinching a dramatic 5,000 metres win after three other runners collided with each other as they approached the finish line.

Britain's Farah led down the final straight at the Diamond League final on Thursday in Zurich, Switzerland, but world champion Muktar Edris came powering through and appeared set to sneak a victory on the line.

Edris fell to the ground after being clipped from behind by Paul Chelimo. In turn, Edris tripped Yomif Kejelcha on the outside. Chelimo stumbled over the line in second, and Edris's momentum took him over in third.

Farah finished in 13 minutes and 6.05 seconds, 0.04 seconds ahead of Chelimo.

The Somali-born 34-year-old had clinched 10 consecutive global titles before Edris ended his streak at the World Championships earlier this month.

Farah will now turn his attention to marathons.

When announcing his decision to leave the track, Farah said that "everything must come to an end at some point".

"I'm a little bit sad, but at the same time I think I have some unfinished business on the road."

Farah won the gold medal in both the 5,000m and 10,000m at the London 2012 Olympics, a feat he repeated four years later in the Rio Games.

Many online congratulated the track star, calling him a "legend" and wished him well as he sets his sights on road races.

End of an era with @Mo_Farah hanging up the track spikes. What an incredible career. Well done Mo, you'll be missed. — Greg Rutherford (@GregJRutherford) August 24, 2017

WHAT. A. WIN.



The ultimate track career is over! @Mo_Farah 👏👏👏



Olympics:🥇🥇🥇🥇

World Champs: 🥇🥇🥇🥇🥇🥇🥈🥈

European Champs: 🥇🥇🥇🥇🥇🥇🥇🥈 pic.twitter.com/13NNqsxSgM — Eurosport UK (@Eurosport_UK) August 24, 2017