The AG2R La Mondiale rider, who is in his third season as a professional, completed the 181km route, which started in Commezzadura, in a time of 4:41:34.
Esteban Chaves (Mitchelton-Scott) finished second, with Davide Formolo (Bora-Hansgrohe) completing the podium.
Fausto Masnada (Androni Giocattoli-Sidermec) crossed the line in fourth, while Krists Neilands (Israel Cycling Academy) placed fifth.
“With 1.5km to go, I said to myself I could do it,” said the stage winner.
“My director was shouting that there was no one behind and I knew that in the final kilometre it flattened out and then was technical so it would be hard for anyone to come back there. So I felt confident from 1 500m.”
View more results below.
Stage 17 results
1. Nans Peters (Fra) AG2R La Mondiale 4:41:34
2. Esteban Chaves (Col) Mitchelton-Scott +0:01:34
3. Davide Formolo (Ita) Bora-Hansgrohe +0:01:51
4. Fausto Masnada (Ita) Androni Giocattoli-Sidermec
5. Krists Neilands (Lat) Israel Cycling Academy
6. Tanel Kangert (Est) EF Education First +0:02:02
7. Valerio Conti (Ita) UAE Team Emirates +0:02:08
8. Gianluca Brambilla (Ita) Trek-Segafredo
9. Chris Hamilton (Aus) Team Sunweb +0:02:22
10. Andrea Vendrame (Ita) Androni Giocattoli-Sidermec +0:02:34
98. Ryan Gibbons (RSA) Dimension Data +0:24:28
1. Richard Carapaz (Ecu) Movistar Team 74:48:18
2. Vincenzo Nibali (Ita) Bahrain-Merida +0:01:54
3. Primoz Roglic (Slo) Team Jumbo-Visma +0:02:16
4. Mikel Landa (Spa) Movistar Team +0:03:03
5. Bauke Mollema (Ned) Trek-Segafredo +0:05:07
6. Miguel Angel Lopez (Col) Astana Pro Team +0:06:17
7. Rafal Majka (Pol) Bora-Hansgrohe +0:06:48
8. Simon Yates (GBr) Mitchelton-Scott +0:07:13
9. Pavel Sivakov (Rus) Team Ineos +0:08:21
10. Davide Formolo (Ita) Bora-Hansgrohe +0:08:59
90. Ryan Gibbons (RSA) Dimension Data +2:45:42