Niccolo Bonifazio was third in the bunch sprint at the end of the flat 159-kilometer (99-mile) route along the Calabrian coast from Pizzo to Praia a Mare.
The only force he couldn't match was the superb showing from the Mitchelton-Scott team, who achieved a rare 1-2 finish atop the mountainous finish.
The two riders had broken from the leading pack at 10 kilometers from the finish.More news: LaMelo Ball praises Celtics' Brad Stevens to put down Lithuanian coach
O'Connor finished 12th, 43 seconds behind Chaves and he is now Team Dimension Data for Qhubeka's best-placed rider in 13th overall and second in the young rider competition. Keeping you up to date about what is happening in Colombia is costly and not without risk.
Yates overtook Chaves in the final metres but sat up on the approach to the finish line and told his teammate to cross first after the Colombian had spent the whole day in the breakaway group.
Britain's Simon Yates maintained the overall lead after finishing safely in the peloton, having taken the pink jersey by finishing second in Thursday's sixth stage.More news: Catalan separatists want to re-elect fugitive ex-leader
Viviani had looked on course to take his third stage win of the race after taking the lead with the line in sight, but the Quick-Step Floors rider had to settle for second place on the same time.
Team Sky's Chris Froome continued to be off the pace and is sitting in eighth place, 1m 10s behind Yates.
With AP Photos.Sam Bennett has timed his sprint to perfection to win the seventh stage of the Giro d'Italia. Rohan Dennis, who held the jersey heading into the stage, fell away during the final climb and is now 53s down on Yates. "There was a little bit of a gap, so I took the chance. Today the goal was to avoid losing seconds and I put in a good performance, so I'm satisfied". "At one point I thought we'd left it too late but the timing was right and I could use my power to get an advantage".More news: SC Collegium sticks to Joseph's elevation
"I could see the same thing with Lotto Jumbo, they went early and Viviani saw the opportunity".
- Rooney 'hasn't asked to leave', Everton boss Allardyce says
- Indiana Republican Party Chairman Welcomes President Donald Trump to Indiana
- City of Calgary calling Alberta Emergency Alert system test a success
- BT to slash 13000 jobs - will Sevenoaks office be hit?
- Facebook May Issue Its Own Cryptocurrency
- United Kingdom customs partnership idea "crazy" says Boris Johnson
- Capitals' Nicklas Backstrom to miss Game 1 against Lightning
- Egypt boss Hany Ramzy advises Mohamed Salah to join Real Madrid
- USA condemns rocket attack by Iran on Israel
- British tourists 'kidnapped' at Virunga wildlife park in Democratic Republic of Congo