Wout van Aert (Jumbo-visma) was the first rider to attack, eventually drawing out a group of 37 riders.
From there, the group quickly built up a lead of around three minutes until the final climb.
On the lower slopes of the Albulapass, Soudal Quick-Step eventually came to fore to set the pace for Remco Evenepoel.
At the front, Neilson Powless attacked with 22km to go, only to be joined by Antonio Tiberi (Bahrain Victorius), Oier Lazkano (Movistar) and Rui Costa (Intermarchse-Circus-Wanty).
In the meantime, Quinn Simmons (Trek-Segafredo) and Sergio Higuita (Bora-Hansgrohe) bridged their to the front. But, the leaders attacked again, swiftly distancing the American rider.
Meanwhile, Gall was ensconced in a still sizable peloton with no-one seemingly keen to attack him.
With 16km to go, Ag2R went to the front and began to push the pace, causing Evenpeol to get caught in the split, while Romain Bardet had made his way into yellow jersey group
With 14km to go, as the front group reached the half-way point of the climb, Powless attacked once again, but to no avail.
Back down the mountain, Ayuso attacked the yellow jersey group, quickly opening up a slight gap.
Before long, he was in sight of the front group, with Tiberi launching his own attack off front. But, he was swiftly neutralized, while Powless began to lose contact.
Moments later, Ayuso breezed past Powless, only to pass the remaining breakaway riders as well.
Ayuso later crested the climb with nearly a minute over the yellow jersey and even more on Evenpoel, followed by a fierce descent that saw speeds over 100kph.
With 10 bonus seconds Ayuso was within touching distance of the GC lead, while various chase groups began to coalesce on the descent.
However, Ayuso continued to increases his advantage, clinging to a gap of around a minute under the flame rouge, later holding onto just enough of a lead claim the stage win.