Fraile was part of a 26 rider break that went clear early in the 161km stage from Firenzo to Bagno di Romagna, and launched his first bid for victory when he attacked with Team Sky's Mikel Landa after just 48km.
At one point that duo had an advantage of more than two minutes, but they were pulled back near the base of the final climb with 40km remaining.
Landa was dropped immediately, but Fraile held on, and then had enough in his legs to follow an attack by Pierre Rolland (Cannondale-Drapac) near the top of the climb.
Joined on the descent to the finish by Rui Costa (UAE Team Emirates) and then Tanel Kangert (Astana), the stage came down to a four-man sprint, with Friale proving the fastest.
It also looked as if it could be day of drama among the GC contenders as Tom Dumoulin found himself with only one team-mate on the first climb of the day, before Sunweb recovered during the middle part of the stage.
However there were attacks by Vincenzo Nibali (Bahrain-Merida) and Thibaut Pinot (FDJ) on the final climb, neither of which were enough to distance the likes of Dumoulin or Nairo Quintana (Movistar), but did shed Geraint Thomas (Team Sky) and Steven Kruiswijk (LottoNL-Jumbo), both of whom lost time in their battles to finish in the top 10.
How it happened
Featuring a hilly route through the Apennines, stage 11 of the Giro d'Italia looked perfectly suited to a breakaway meaning a fast start to the stage as riders fought to get in the move.
By the opening slopes of the first climb, the second category Passo dello Consuma, a large group of 26 riders had gone clear, opening a small gap on the peloton, which itself was whittled down to only around 40 riders on the climb.
In the front group were Giovanni Visconti (Bahrain-Merida), Hubert Dupont and Matteo Montaguti (Ag2r-La Mondiale), Dario Cataldo and Tanel Kangert (Astana), Simone Andreeta (Bardiani-CSF), Ben Hermans (BMC Racing), Pierre Rolland, Hugh Carthy, and Davide Villella (Cannondale-Drapac), Ivan Rovny (Gazprom-Rusvelo), Tomasz Marczynski and Maxime Monfort (Lotto Soudal), Andrey Amador, José Herrada and José Joaquin Rojas (Movistar), Ruben Plaza (Orica-Scott), Laurens De Plus (Quick-Step Floors), Igor Anton and Omar Fraile (Dimension Data), Martijn Keizer (LottoNL-Jumbo), Philip Deignan and Mikel Landa (Team Sky), Laurens ten Dam (Team Sunweb), Rui Costa and Simone Petilli (UAE Team Emirates).
The final kilometres of the climb saw De Plus and Anton attack from the front group, with De Plus taking maximum points across the line at the top.
That duo held a gap of around 16 seconds over the chasers, with another 30 seconds back to the drastically reduced peloton, including race leader Tom Dumoulin who found himself with only a one team-mate for company before the group swelled as riders caught up on the descent.
By the base of the second climb of the stage, the Passo della Calla, De Plus and Anton had been swept up by the chasing group, creating a group of 26 riders with a two minute advantage over the pink jersey, but that group was swiftly back down to 25 riders as Mikel Landa and Omar Fraile countered.
Landa and Fraile worked well together on the steady slopes of the third category climb, and by the time they reached the summit with 97km to go they had a lead of two minutes over the chasers, with the peloton, led by Team Sunweb, at more than five minutes.
With 70km remaining, and the gap to Landa and Fraile only expanding, Montaguti attacked from the chasing group, but was quickly chased down, before José Herrada tried a similar move which met the same fate.
By the top of the next climb, Landa and Fraile had extend to their advantage by a handful of seconds, but that then started to fall, coming back within two minutes for the first time in an hour as they went through the finish line for the first time with 50km to go.
From there the next 23km were uphill, and gap for the leaders fell dramatically as the chase group began to push on, eventually making the catch with 40km to go in the stage and dropping Landa immediately.
Watch: Giro d'Italia stages 10-15 preview
Most riders in the group were looking for the stage win, but Andrey Amador, ninth overall going into the stage at 4-39, also had one eye on moving up in the GC.
The gap to the peloton still at more than three minutes, the likes of FDJ and Trek-Segafredo were forced to move to the front as they looked after the top five positions of Thibaut Pinot and Bauke Mollema.
Movistar smelled an opportunity, and put José Herrada and then José Joaquin Rojas to the front of the break to drive the pace, dropping a number of riders from the break and holding the gap to the peloton at around 2-45.
With 29km remaining Rojas pulled off the front, and with everyone waiting for an attack from Amador, it came from De Plus instead.
The Quick-Step rider's move was closed down, but he was then able to jump on the wheel of Costa as the Portuguese counter-attacked with Pierre Rolland also following.
The trio briefly worked well together, but as it looked like they were going to be caught Rolland attacked again, going solo on to the steepest part of the climb.
A counter-attack came from Fraile, who took the points at the top of the climb, meaning there were two men going over the top with a gap of a few seconds over the chasers, including Amador.
There was also action in the main group as Franco Pellizzotti (Bahrain-Merida) upped the pace with team-mate Vincenzo Nibali on his wheel, decimating the peloton but with all of the GC contenders in contention.
Moving on to the steepest part of the climb and Nibali attacked, not strongly enough to shed Dumoulin, Quintana, or Pinot, but putting Thomas and Kruiswijk out of the back.
The next attack came from Pinot, who was able to open a gap, cresting the climb eight seconds ahead of the rest of the race favourites.
From the top of the Monte Fumaiolo it was 24km, almost entirely downhill to the line, which inevitably meant that Nibali went straight to the front to force the pace, while at the head of the race Fraile and Rolland held 17 seconds over the rest of the breakaway.
Nibali's descending skills meant Pinot was quickly caught, but Fraile and Rolland were having better luck, edging out the odd second here and there to extend their advantage at the front of the race.
However the descent was interrupted by a brief uphill section with 14km to go, which seemed to dull the legs of Fraile and Rolland who saw their lead trimmed as Costa attacked from the chasers, quickly having the leaders in his sights but making hard work of making the catch.
The UAE Team Emirates rider finally made it across to make it three leaders with 9km remaining, with the chasing group, now down to eight riders, 18 seconds behind, and the pink jersey group at 2-07.
Entering the final three kilometres and the gap was down to just 10 seconds as the three leaders starting to look around and suddenly the chasers were once again in with a shout.
That meant four riders with a 13 second lead going under the flamme rouge - Kangert, followed by Rolland, followed by Costa and Fraile.
Kangert sat on the front as the chasers closed in quickly, but it was Fraile who came around the outside, holding it all the way to the line to win his first Grand Tour stage.
The pink jersey group rolled across the line 1-37 with Dumoulin giving a thumbs up to team-mate Laurens Ten Dam at the end of a tough day in the saddle.
However there were no thumbs up in the group containing Thomas and Kruijswijk, who rode well to limit their losses to 48 seconds to the group containing the other GC contenders, but would have hoped for better at the start of the day.
Giro d'Italia 2017, stage 11: Firenze to Bagno di Romagna (161km)
1. Omar Fraile (Esp) Dimension Data, in 4-23-14
2. Rui Costa (Por) UAE Team Emirates
3. Pierre Rolland (Fra) Cannondale-Drapac
4. Tanel Kangert (Est) Astana Pro Team
5. Giovanni Visconti (Ita) Bahrain-Merida
6. Ben Hermans (Bel) BMC Racing Team
7. Dario Cataldo (Ita) Astana Pro Team
8. Simone Petilli (Ita) UAE Team Emirates, all at same time
9. Maxime Monfort (Bel) Lotto Soudal, at 3 secs
10. Laurens De Plus (Bel) Quick-Step Floors, at same time
General classification after stage 11
1. Tom Dumoulin (Ned) Team Sunweb, in 47-22-07
2. Nairo Quintana (Col) Movistar Team, at 2-23
3. Bauke Mollema (Ned) Trek-Segafredo, at 2-38
4. Thibaut Pinot (Fra) FDJ, at 2-40
5. Vincenzo Nibali (Ita) Bahrain-Merida, at 2-47
6. Andrey Amador (CRc) Movistar Team, at 3-05
7. Bob Jungels (Lux) Quick-Step Floors, at 3-56
8. Tanel Kangert (Est) Astana Pro Team, at 3-59
9. Domenico Pozzovivo (Ita) AG2R La Mondiale, at 4-05
10. Ilnur Zakarin (Rus) Katusha-Alpecin, at 4-14
12. Steven Kruijswijk (Ned) Team LottoNL-Jumbo, at 6-07
14. Geraint Thomas (GBr) Team Sky, at 6-21
16. Adam Yates (GBr) Orica-Scott, at 6-58
Tweets of the week: Evie Richards tries skateboarding, Alex Dowsett's puncture nightmare and more
Here's a selection of our favourite tweets from the last seven days
By Alex Ballinger •
Lezyne Macro Drive 1300XXL review
A quality option that offers up a greater battery life than the competition and produces a wide beam that helps keep your peripheral vision informed
By Michelle Arthurs-Brennan •
Road World Championships 2021: women’s individual time trial start list
List of starters for the elite women's individual time trial at the 2021 UCI Road World Championships at Bruges on Monday 20 September
By Ryan Dabbs •
Vuelta a España 2021 route: Nine summit finishes and no Madrid finale in this year's edition
The route for the third and final Grand Tour of the season is set to test the legs with nine uphill finishes
By Tim Bonville-Ginn •
Egan Bernal tests positive for Covid-19 days after Giro d’Italia victory
The Colombian star had been scheduled to return home after winning the Giro but will now self-isolate in Europe
By Alex Ballinger •
Giro d’Italia was Remco Evenepoel’s ‘first defeat,’ says Patrick Lefevere
Evenepoel went into the Giro as one of the favourites despite a lack of racing due to injury
By Alex Ballinger •
Giro d'Italia 2021 ratings: how did each team perform?
Team ratings from the 2021 Italian Grand Tour
By Stephen Puddicombe •
Egan Bernal 'empty' after Giro victory, doesn't think he'll be able to race Tour de France
Egan Bernal won the Giro d'Italia 2021 but doesn't think he'll be good enough to go on to race the Tour this summer
By Jonny Long •
Five talking points from stage 21 of the Giro d'Italia 2021
The final talking points from the 104th Giro d'Italia
By Stephen Puddicombe •
Giro d'Italia 2021 standings: The final results from the 104th edition
Giro d'Italia 2021: all the standings for the stages, overall, mountains, points, best young rider and team standings throughout the race
By Tim Bonville-Ginn •