Primož Roglič has become the first Slovenian to win the Giro d'Italia ©Getty Images

Primož Roglič held on to clinch his first title at the Giro d'Italia as Britain's Mark Cavendish sealed an emotional win in the final stage.

Astana Qazaqstan man Cavendish announced earlier on in the race that this season would be his last.

The 38-year-old rolled back the years in Rome as he completed the 126-kilometre route around the capital in 2hour 48min 26sec.

It was a 17th career Giro stage win for Cavendish who kept his record alive of winning at least one stage every time he took part in the Grand Tour event.

He was able to open up several bike lengths over Dutchman Alex Kirsch, who won silver, and Colombian Fernando Gaviria even before a crash on the final approach split the lead bunch.

As a result, Gaviria dropped to seventh and Italy's Filippo Fiorelli made up the podium.

Cavendish, who became the oldest stage winner in Giro history, was helped towards the line by Welshman Geraint Thomas who ceded control of the pink jersey in yesterday's stage.

The Ineos Grenadiers rider provided a lead-out going into the final two kilometres before offering his congratulations.

Cavendish will now set his sights to the Tour de France where he will aim to take the outright record of stage victories in July.

He is currently tied with Belgian Eddy Merckx on 34.

The final stage offered little excitement at the top of the general classification as Roglič became the first Slovenian to win the Giro d'Italia.

He had all but claimed victory yesterday after snatching the pink jersey on the penultimate stage as the six-lap circuit in the capital was largely processional.

Roglič now adds to the Giro crown to his three Vuelta a España titles from 2019, 2020, and 2021.

He finished 14 seconds in front of Thomas and 1:15 ahead of Portugal's younger rider champion João Almeida.

It represents the smallest finishing gap between the top riders since Merckx won by 12 seconds over Italian Gianbattista Baronchelli in 1974.