Guerreiro beat fellow breakaway rider Jonathan Castroviejo (Ineos-Grenadiers) of Spain by jumping away in the last 300 metres of the final climb to claim the second stage win at this year's Giro for EF Pro Cycling.
The previous Portuguese rider to win a stage on the Giro was Acacio Da Silva in 1989.
“It means a lot to me to win a stage at the Giro," Guerreiro said.
"This is only my second Grand Tour. After such a hard start today, I was happy to make the breakaway."
"Castroviejo was the strongest on the flat sections, so I knew I had to save some energy for the last kilometre that suited me well.
"(Race leader) João Almeida is like a little brother for me. We both raced for Axel Merckx’ team before. It’s fantastic to both have success and distinctive jerseys at the Giro d’Italia.”
Almeida retained the overall leader’s Maglia Rosa despite losing time on other top contenders in the steepest, final part of the last ascent.
The Deceuninck-Quick Step rider crossed the line four seconds behind double Giro champion Vincenzo Nibali and 18 behind Denmark’s Jakob Fuglsang and Dutchman Wilco Kelderman.
Steven Kruijswijk of the Netherlands was the top rider who lost most ground, finishing 21 seconds adrift of Fuglsang and Kelderman, who is second overall, 30 seconds off the pace.
24-year-old Lucas Hamilton (Mitchelton-Scott) tried his luck on the final climb, joined by Tao Geoghegan Hart (INEOS Grenadiers) in his attack. Their advantage over the bunch quickly grew to 30 seconds on the eye-watering pitches nearer the finish. Although the gap eventually came down, Hamilton held on for seventh and an improvement of two spots to 15th overall.
After Monday’s rest day, Tuesday’s 10th stage will be a 177-km mountain trek between Lanciano and Tortoreto.