Portugal's João Almeida retained his overall lead at the Giro d'Italia ©Getty Images

Portugal's João Almeida retained his overall lead at the Giro d'Italia after successfully seeing off an attack from the Sunweb team on the 17th stage of the race.

Almeida, who rides for Deceuninck-QuickStep, clung on to his 17-second advantage over Dutchman Wilco Kelderman following the 203 kilometres stage from Bassano del Grappa to Madonna di Campiglio, won by Australia's Ben O'Connor.

The Portuguese survived an attack from Kelderman to ensure he keeps the pink jersey heading into tomorrow's 18th stage, a 207km route from Pinzolo to Laghi di Cancano.

O'Connor claimed his first Grand Tour stage victory after breaking away from a lead group of 14 riders on the final ascent.

The Australian NTT Pro Cycling rider finished in 5hours 50min 59sec, crossing the line 31sec in front of Austria's Hermann Pernsteiner.

Australia's Ben O'Connor recorded his first Grand Tour stage victory ©Getty Images
Australia's Ben O'Connor recorded his first Grand Tour stage victory ©Getty Images

Thomas De Gendt of Belgium did enough for third.

Victory for O'Connor saw the Australian recover from the disappointment of having to settle for second in the sprint for the line at the end of yesterday's 16th stage.

"The second place left me feeling pretty bitter," O'Connor said.

"I was able to bounce back and get this success, it's a dream to get a victory in a Grand Tour."

Almeida was also pleased with his day's work as he kept hold of top spot going into the final few days of the race.

"It was a hard day, a lot of climbing, but I had the perfect team with me," he said.