Wout Van Aert secured his second victory of the Tour of Britain as he battled to an uphill sprint finish on the line in Llandudno to reclaim the overall race lead after stage four.
The 210-kilometre course started in Aberaeron and ran parallel to the Welsh coastline, venturing into Snowdonia National Park before a final energy-sapping climb up alongside the Great Orme's tramway.
With Ineos Grenadiers having claimed a time-trial victory on Tuesday, Ethan Hayter had been pushed into the leader's jersey ahead of team-mate Rohan Dennis and Belgian Van Aert, who had taken the opening stage for Jumbo-Visma.
Several riders attacked over the latter stages, with the peloton clawing back one gap of almost 10 minutes, before the contenders dug in at the base of the Great Orme trek.
Hayter was among those well positioned, while Michael Woods (Israel Start-Up Nation) soon looked to up the pace before Denmark's Mikkel Honore hit the front for Deceuninck-Quick-Step.
World champion Julian Alaphilippe then attacked to press home his advantage over Van Aert in a push up to the line.
However, it was Van Aert who somehow found the strength to edge ahead in the final few metres – with both men dropping to the floor exhausted after dismounting at the summit finish.
Van Aert moves back ahead of British rider Hayter to take a slender two-second lead, with Alaphilippe 11 seconds back in third place for Deceuninck-Quick-Step.
Stage five will run through 152.2km from Alderley Park to Warrington, finishing outside the town's Golden Gates landmark.