Quick-Step Floors was outmuscled for much of the final kilometres, with Cofidis, Lotto-Soudal and Trek-Segafredo all putting men up front. A late dig by lead-out man Max Richeze strung out the peloton and opened things up for Gaviria, who had been sitting on the wheel of Andre Greipel.
Gaviria struck out first and stormed past those in front of him. Greipel tried to follow the Colombian but found himself boxed in on a number of occasions. The German almost came around him in the final metres but he sat up when a minor deviation from Gaviria forced him to change his line. Greipel, unhappy with the action, remonstrated with Gaviria immediately after the stage but later congratulated him on Twitter on his turn of pace.
The win is Gaviria's third this season, after he claimed two stages in Argentina at the Vuelta a San Juan. However, this one was all the sweeter because this time there were even more of the top sprinters on show.
"I am very happy, because I just came back from Colombia, where I worked really well, and this win shows this," Gaviria said. "It was a sprint royale, with some of the world's fastest riders fighting for victory, and to beat them is really nice, especially as the wind was pretty strong out there. A big thanks to the team, because they were perfect and did a superb job today."
The victory had the added bonus of earning Gaviria a ticket home for the national championships later this month. The 22-year-old has his eyes set on wearing the national jersey for the remainder of the season.
"Yesterday I made a bet with Davide Bramati, who promised that if I win a stage here, then I get the green light to line up at the National Championships on February 26th," he explained. "I'm delighted to have won this bet and get the ticket for Colombia. It would be a huge pride to wear this beautiful jersey at least once in my career and I hope it will happen this year."
The Volta ao Algarve continues on Thursday with a stage from Lagoa - Fóia (Monchique). Gaviria will have to wait until stage 4 for his next opportunity, with the summit finish to Alto da Fóia setting up the general classification battle.