Ewan was given a perfect lead-out into the final 200m, but had to fight hard to hold off a stellar sprinting field on the cobbled final few hundred metres in the Scottish borders.
Ewan's bike was bouncing underneath him through the final sprint, but he just managed to hold on in a photo finish, with Boasson Hagen edging out Viviani for second.
How it happened
The opening stage of the 2017 Tour of Britain saw a group of eight riders escape early in the stage, with a number of domestic teams being represented. In the move were Mark McNally (Wanty-Groupe Gobert), Rob Partridge (Bike Channel-Canyon), Gorka Izagirre (Movistar), Graham Briggs (JLT Condor), Connor Swift (Madison-Genesis), Karol Domagalski (One Pro Cycling), Lukasz Owsian (CC Sprandi-Polkowice), and Jacob Scott (An Post CRC).
They quickly opened a gap of just over three minutes which remained steady for much of the stage, with McNally and Briggs sharing the spoils at the intermediate sprint, while Swift took the first KOM.
BMC Racing attempted to split the peloton in crosswinds with 63km remaining, but were not able to do any damage in the main bunch. However the injection of pace did bring the gap to the break down to just 30 seconds over the course of a few kilometres.
That gap saw most of the breakaway riders give up the ghost and drop back to the peloton, but the two Poles in the move, Domagalski and Owsian, decided to have another go, and opened their advantage back out beyond a minute.
Owsian led over the penultimate KOM point of the day, but from there onwards the two leaders' advantage was quickly trimmed as Katusha-Alpecin and Dimension Data worked hard on the front of the pack.
The final climb of the day saw Owsian set off solo, but did not have enough to get to the summit ahead of the peloton, led Scott Thwaites (Dimension Data). The pace was high, but not high enough to deter an attack by Ben Hermans (BMC Racing), the Belgian rider jumping clear but unable to open a gap, with Laurens De Plus (Quick-Step Floors) taking maximum KOM points.
A few more attacks followed on the descent, but nothing was going to prevent a bunch sprint as the sprinters' teams starting to assemble on the front of the bunch.
>>> Tour of Britain 2017 route: stage-by-stage details and where to watch
Team Sky, working for Viviani, were unsurprisingly prominent, but the likes of Quick-Step Floors, One Pro Cycling, Orica-Scott, and Lotto-Soudal were all close to the front as the six-strong teams struggled to maintain a grip on the front of the bunch.
Orica-Scott led into the final few hundred metres with Caleb Ewan in second wheel, but Boasson Hagen went early onto the cobbled road for the final run to the line. Kristoff and Viviani were coming fast on the right-hand side, but it was Ewan who won it to take the race lead.
Tour of Britain 2017, stage one: Edinburgh to Kelso (190km)
1. Caleb Ewan (Aus) Orica-Scott, in 4-34-17
2. Edvald Boasson Hagen (Nor) Dimension Data
3. Elia Viviani (Ita) Team Sky
4. Alexander Kristoff (Nor) Katusha-Alpecin
5. Fernando Gaviria (Col) Quick-Step Floors
6. Chris Lawless (GBr) Great Britain
7. Brenton Jones (Aus) JLT Condor
8. Nikolas Maes (Bel) Lotto Soudal
9. Zdenek Stybar (Cze) Quick-Step Floors
10. Floris Gerts (Ned) BMC Racing
General classification after stage one
1. Caleb Ewan (Aus) Orica-Scott, in 4-34-07
2. Edvald Boasson Hagen (Nor) Dimension Data, at 3 secs
3. Karol Domagalski (Pol) One Pro Cycling, at 4 secs
4. Elia Viviani (Ita) Team Sky, at 6 secs
5. Alexander Kristoff (Nor) Katusha-Alpecin, at 10 secs
6. Fernando Gaviria (Col) Quick-Step Floors
7. Chris Lawless (GBr) Great Britain
8. Brenton Jones (Aus) JLT Condor
9. Nikolas Maes (Bel) Lotto Soudal
10. Zdenek Stybar (Cze) Quick-Step Floors, all at same time
Thank you for reading 20 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1