Fernando Gaviria, right, outsprinted Peter Sagan to win stage six ©LaPresse - D'Alberto / Ferrari

Colombia’s Fernando Gaviria held off the challenge of Slovakia’s Peter Sagan in a closely fought sprint to win the penultimate stage of the Tirreno-Adriatico.

Reigning world champion Sagan had already won two stages at this year’s race, which forms part of the International Cycling Union (UCI) WorldTour.

The Bora-Hansgrohe rider had high hopes of a hat-trick of successes, with the 168 kilometre route from Ascoli Piceno to Civitanova Marche offering the sprinters a rare opportunity.

A seven-man breakaway attempted to upset the sprinters teams, but their move was reduced to just Italy’s Davide Ballerini and Ben Gastauer of Luxembourg in the closing kilometres.

Their effort would ultimately prove futile, leaving Gaviria and Sagan to go head-to-head for the stage win.

Gaviria edged narrowly ahead to take the victory via a photo-finish, with the Quick-Step Floors rider given a winning time of 4 hours 9min and 31sec.

Nairo Quintana leads the general classification by 50 seconds heading into the final stage ©Getty Images
Nairo Quintana leads the general classification by 50 seconds heading into the final stage ©Getty Images

“We really wanted to win," said Gaviria.

“This was the first day for the sprinters.

“On stage three, I crashed and the legs weren't excellent, but now I'm going well.

“The climb before the finish made the race a little Milan-San Remo today.

“It's always a nice duel with Peter Sagan but also a fight with the other riders, I'm glad I got this one.”

Gaviria’s fellow countryman Nairo Quintana remains in the overall race lead, with the Movistar ace holding a 50sec lead over second place Thibaut Pinot of France.

The duo will look to preserve their positions on tomorrow’s final stage, with the field set to contest a 10km individual time trial in San Benedetto del Tronto.

Australia’s time trial specialist Rohan Dennis, who lies 1:06 behind Quintana in third, could gain significant time on his rivals on the flat course.