Simon Yates won stage 19 of the Giro d'Italia to set up a fascinating final weekend of the race even as Egan Bernal managed to add a few more seconds to his overall lead.

Just as he did on the Sega di Ala on Wednesday, Yates rode away from Bernal on the Alpe di Mera at the end of the 166km stage from Abbiategrasso, taking 28 seconds out of the Colombian who remains troubled by a back problem.

Bernal took third to push his advantage over second-placed Damiano Caruso up to two minutes 29 seconds, but all eyes will be on the in-form Yates - now a further 20 seconds back in third - going into Saturday's brutal stage to the Alpe Motta before Sunday's closing time trial in Milan.

Ireland's Dan Martin, who won stage 17 on Wednesday, took an excellent sixth and remains 10th overall for Israel Start-Up Nation.

"I'm really happy," Yates said. "The team did a fantastic job today, they really controlled the start and worked a lot and I managed to finish it off so I'm really happy.

"I saw the boys from Ineos were happy just to ride a tempo and I had a feeling they would let me go today. I read something from Egan on Twitter or whatever about how they would be conservative and try to control rather than go with me and as soon as I attacked I saw that was correct."

It was on stage 19 of the 2018 Giro that Yates, having spent 13 days in pink, cracked at the moment that Chris Froome sprang forward to victory, but three years later the 28-year-old is the rider coming into form just as Bernal is put on the defensive.

This day was all about the final 10km climb, with organisers having amended the original route to remove the planned ascent of the Mottarone after the cable car disaster which killed 14 people on the mountain on Sunday. All prize money from the day was donated to the families of the victims.

Yates wasted little time in attacking on the climb to the finish, with the Team BikeExchange rider going clear with six and a half kilometres still to go.

Caruso and others tried to follow as Bernal initially offered no reaction, showing maturity as he paced his way up the climb without panic.

"I felt actually really good," Bernal said. "I did really good numbers, a really good climb. Of course Yates was the best today and chapeau to him but I'm really happy with my condition.

"Tomorrow with the altitude I hope to have the same feelings and I just try to manage the gap I have. I have some time to play with and I also want to have good legs for the time trial. Everything should be OK if I'm feeling good."

But Bernal's rivals have seen the damage that can be done on a single mountain, and will now relish the thought of Saturday's feast of climbing.

The 164km run from Verbania, which takes the peloton over two passes at more than 2,000 metres before the summit finish in Valle Spluga, should be the Colombian's natural habitat, but after two days of struggles this week Yates will get the better night's sleep.

"Today was not the most difficult of stages," Yates said. "It was a very, very difficult final climb but tomorrow is very different, a very hard stage. We're back in the high altitude. We'll see what I can do. I'm just doing my best at the moment and I'm really happy with the stage win."