Valerio Conti (UAE Team Emirates) retained the overall lead after finishing 3min 34sec behind Jumbo-Visma's Roglic, who crushed most of the overall contenders with a time of 51 minutes 52 seconds.
Vincenzo Nibali (Bahrain-Merida) limited the damage as he finished one minute five seconds behind after a strong showing in the finale, a 12.25-km climb in San Marino, to take fourth. Victor Campenaerts (Lotto Soudal) and Bauke Mollema (Trek-Segafredo) finished second and third respectively.
Simon Yates (Mitchelton Scott) took a beating as he lost 3min 11sc to Roglic, and Miguel Angel Lopez (Astana) ended up 3min 45sec off the pace after all the general classification contenders had completed their runs in wet conditions.
“It’s a perfect performance in my mind. I did a good job. I took it easy at the beginning and I gave it all at the end. It’s nice to take some time over the other GC favourites but the Giro is far from over,” Roglic said.
It was a spectacular reverse of fortune for Yates, who had been strong in the opening time trial after warning his rivals they should be scared of him.
Overall, Conti, who is not among the main GC contenders, leads Roglic, winner of the first time trial, by 1min 50sec.
Roglic has a one minute 44-second advantage over Nibali in the overall standings before the Giro hits the mountains and 3min 46sec on Yates.
The first mountain stage will be contested on Friday, which could reshuffle the overall standings as Yates, Nibali and Lopez are expected to attack during the most gruelling part of the race.
Monday is the three-week race’s first rest day.