Portugal's Joao Almeida ensured he will wear the pink jersey for a 14th consecutive day after defending his overall race lead on Tuesday on the Giro d'Italia's 16th stage won by Slovenian Jan Tratnik.
Tratnik, a 30-year-old Bahrain McLaren rider, crossed the line seven seconds ahead of Australian Ben O'Connor, after the run from Udine on the border with Slovenia.
Almeida finished nearly 13 minutes off the pace among the peloton of favourites but gained a valuable two seconds on Dutch rival Wilco Kelderman.
The race finishes in Milan on October 25.
"Sometimes the best defence is to attack," said the Deceuninck-Quick-Step rider.
"In the end I was feeling good and I attacked, gaining a few seconds."
Almeida bared his teeth in the final kilometre push for the line at San Daniele del Friuli in north-eastern Italy, leaving Team Sunweb's Kelderman second overall at 17sec.
Kelderman's Australian teammate Jai Hindley, third overall, is nearly three minutes adrift, having finished first among the pursuing group which including two-time race winner Vincenzo Nibali of Italy.
It was a first Giro stage win for Tratnik, who outwitted his final breakaway rival O'Connor in the race for the line.
The 28-rider breakaway had formed in the first hour, but without any of the challengers for overall victory.
Tratnik and Italian Manuele Boaro broke clear 60km from the finish, with the Slovenian shaking off the Astana Pro Team rider with 40km to go, building up a comfortable 40-second lead on the pursuing group.
O'Connor fought back on the final climb of three up Monte di Ragogna, with 13km to go, with Tratnik letting the Australian lead in the final kilometre before pulling clear for the line.
"I attacked so far from the finish and the last climb was very hard," said Tratnik.
"I didn't think I could do it, but in the end, it was a perfect day. We are close to the Slovenian border so today my brother and my girlfriend were here.
"500 metres from the finish I saw my girlfriend and I found some extra energy that allowed me to win".
It was his ninth career win and second WorldTour victory after the prologue of the Tour de Romandie last year.
There were two positive tests for coronavirus before the stage.
Colombian sprinter Fernando Gaviria tested positive among a batch of 492 during Monday's rest day. The second was an AG2R La Mondiale team employee.
"Gaviria went straight into isolation after the test result. He feels fine and is completely asymptomatic," his UAE Emirates team announced.
"All the other riders and staff members returned negative tests and will have other tests today," they added.
Gaviria, who also tested positive for the virus in February, had been 126th out of 138 overall.
Monday's total of two positives was down on the first round of testing, when the virus was detected in riders Steven Kruijswijk and Michael Matthews along with six team personnel.
The day after the first tests, two teams quit the race -- Kruijswijk's Jumbo-Visma outfit and Michelton-Scott whose leader Simon Yates had stopped after developing minor symptoms.
Wednesday's 17th stage hits the Dolomites with 203km from Bassano del Grappa to the Madonna di Campiglio ski resort, with three climbs including a final one over 12.5km.
Results and standings after the 16th stage of the Giro d'Italia on Tuesday, over 229km from Udine to San Daniele del Friuli:
1. Jan Tratnik (SLO/Bahrain) 6hr 04min 36sec, 2. Ben O'Connor (AUS/NTT) at 07sec, 3. Enrico Battaglin (ITA/BAH) 1:14, 4. Kamil Malecki (POL/CCC) 1:14, 5. Ben Swift (GBR/INE) 1:14, 6. Andrea Vendrame (ITA/ALM) 1:21, 7. Geoffrey Bouchard (FRA/ALM) 1:21, 8. Matteo Fabbro (ITA/BOR) 1:25, 9. Manuele Boaro (ITA/AST) 1:33, 10. Alessandro Tonelli (ITA/BAR) 1:37.
28. Joao Almeida (POR/DEC) 12:54, 29. Jai Hindley (AUS/SUN) 12:56, 30. Vincenzo Nibali (ITA/TRE) 12:56, 31. Tao Geoghegan Hart (GBR/INE) 12:56, 33. Jakob Fuglsang (DEN/AST) 12:56, 34. Wilco Kelderman (NED/SUN) 12.56, 35. Pello Bilbao (ESP/BAH) 12:56, 36. Rafal Majka (POL/BOR) 12:56.
1. Joao Almeida (POR/DEC) 65hr 45min 08sec, 2. Wilco Kelderman (NED/SUN) at 17sec, 3. Jai Hindley (AUS/SUN) 2:58, 4. Tao Geoghegan Hart (GBR/INE) 2:59, 5. Pello Bilbao (ESP/BAH) 3:12, 6. Rafal Majka (POL/BOR) 3:20, 7. Vincenzo Nibali (ITA/TRE) 3:31, 8. Domenico Pozzovivo (ITA/NTT) 3:52, 9. Patrick Konrad (AUT/BOR) 4:11, 10. Fausto Masnada (ITA/DEC) 4:24, 11. Brandon McNulty (USA/UAE) 4:31, 12. Jakob Fuglsang (DEN/AST) 5:09.
50. Jan Tratnik (SLO/BAH) 1h 33min 23sec, 81. Peter Sagan (SVK/BOR) 2hr 22min 49sec