Under mostly clear skies, Team Sky’s Thomas took the lead with three laps to go, with Sagan and Mitchelton-Scott team’s Trentin at close quarters.

After emerging from the trio in a nail-biting finish, the 28-year-old Sagan, of the Bora-Hansgrohe team, said: “I am very happy for this victory. I tried to save energy and see in the last three or four laps.

“I saw it was a strong group with Thomas and Trentin.

“The first few laps were a bit bad, but then they became better and better after every lap.”

The star-studded race attracted a decent-sized crowd in central Shanghai.

Bicycles have long been the workhorse of urban transport for China’s masses, but recreational cycling is on the rise as incomes and leisure pursuits increase.

Veteran Spaniard Alejandro Valverde, the newly crowned world champion, triumphed at the Tour’s Saitama Criterium earlier this month in Japan.