Ruben Guerreiro won stage nine of the Giro d'Italia as fellow Portuguese rider Joao Almeida retained the pink jersey going in to Monday’s rest day.

Guerreiro picked up a second stage victory for EF Education First as he broke the heart of the Ineos Grenadiers’ Jonathan Castroviejo in the final few hundred metres of the 208km stage from San Salvo to Roccaraso.

Joao Almeida crossed the line a little under two minutes later but saw his advantage cut to 30 seconds as Wilco Kelderman moved up to second place with a late dig off the front of the peloton.

"The team did an incredible job," Deceuninck-QuickStep’s Almeida said.

"They were perfect and it is thanks to my team-mates that now I still wear the Maglia Rosa. I’m also happy for my compatriot Guerreiro, he deserves the win!"

Guerreiro and Castroviejo had been part of an eight-man breakaway which gradually broke apart on the steady uphill finish to a stage with a total of 4,000 metres of climbing.

Castroviejo tried to go alone with six kilometres left but Guerreiro followed and then overhauled the Spaniard in the final few hundred metres to follow up on team-mate Jonathan Caicedo’s victory on Mount Etna on Monday.

"Finally, what a great satisfaction," Guerreiro said. "The team and I really deserved this victory. It was very difficult to get into the breakaway this morning and it’s extraordinary to win today."

The peloton broke apart on the steep ramps to the finish line, with Kelderman and Jakob Fuglsang able to distance Vincenzo Nibali and Steven Kruijswijk.

That saw a reordering of the top 10, with Pello Bilbao of Bahrain-McLaren slipping to third, nine seconds behind Team Sunweb’s Kelderman.

Domenico Pozzovivo moved up to fourth place, 53 seconds off pink, while fellow Italian Nibali remains fifth with a deficit of 57 seconds to Almeida, though the two-time winner is now just four seconds clear of Fuglsang in sixth.

Kruijswijk slipped out of the top 10, though he remains firmly in contention, 84 seconds from Almeida.