In one of the most exciting final stages of a Grand Tour, British rider Tao Geoghegan Hart won the Giro d’Italia on Sunday, edging out Australian Jai Hindley by just 39 seconds.

That was all that separated them after nearly 3,500 kilometers (2,175 miles) of racing.

For the first time in Grand Tour history, the first- and second-place riders had the same overall time on the eve of the last stage, and Geoghegan Hart proved to be quicker than Hindley in a tense individual time trial in Milan.

Britain's Tao Geoghegan Hart competes during the final stage of the Giro d'Italia cycling race, a 15.7 kilometers (9.756 miles) individual time trial from Cernusco sul Naviglio to Milan, Italy, Sunday, Oct. 25, 2020. (AP PhotoLuca Bruno)

Britain's Tao Geoghegan Hart competes during the final stage of the Giro d'Italia cycling race, a 15.7 kilometers (9.756 miles) individual time trial from Cernusco sul Naviglio to Milan, Italy, Sunday, Oct. 25, 2020. (AP PhotoLuca Bruno)

Neither of them had ever finished higher than 20th in a Grand Tour.

Wilco Kelderman was third overall at the end of the three-week race, which appears to have finished just in time with rising numbers of coronavirus cases in Italy and new restrictions announced in the country.

Geoghegan Hart's Ineos Grenadiers teammate Filippo Ganna was fastest on Sunday, with a time of 17 minutes, 16 seconds on the mostly flat 15.7-kilometer (10-mile) route, which finished next to Milan’s iconic cathedral.

Reigning World Champion Italy's Filippo Ganna, right, rides past Milan's gothic cathedral after completing the final stage of the Giro d'Italia cycling race, a 15.7 kilometers (9.756 miles) individual time trial from Cernusco sul Naviglio to Milan, Italy, Sunday, Oct. 25, 2020. (AP PhotoLuca Bruno)

Reigning World Champion Italy's Filippo Ganna, right, rides past Milan's gothic cathedral after completing the final stage of the Giro d'Italia cycling race, a 15.7 kilometers (9.756 miles) individual time trial from Cernusco sul Naviglio to Milan, Italy, Sunday, Oct. 25, 2020. (AP PhotoLuca Bruno)

It was the Italian's fourth win in 21 stages.

More AP sports: https://apnews.com/apf-sports and https://twitter.com/AP_Sports

Reigning World Champion Italy's Filippo Ganna competes during the final stage of the Giro d'Italia cycling race, a 15.7 kilometers (9.756 miles) individual time trial from Cernusco sul Naviglio to Milan, Italy, Sunday, Oct. 25, 2020. (AP PhotoLuca Bruno)

Reigning World Champion Italy's Filippo Ganna competes during the final stage of the Giro d'Italia cycling race, a 15.7 kilometers (9.756 miles) individual time trial from Cernusco sul Naviglio to Milan, Italy, Sunday, Oct. 25, 2020. (AP PhotoLuca Bruno)