The 21-year-old gave the European champions a 17th-minute lead when he slotted home Bernardo Silva’s knock-down before Bruno Fernandes headed in a second before the break.
Fernandes’ goal was set up by captain Ronaldo, who was making his 150th appearance for his country and first since winning the Champions League final with Real Madrid, having sat out the friendlies against Tunisia and Belgium.
Guedes completed the scoring just before the hour when he headed in Raphael Guerreiro’s pull-back.
Portugal’s defence, which has looked ponderous in recent matches, coped well with Algeria’s attacking threat and Rui Patricio had to make only one save, from substitute Baghdad Bounedjah.
“There were some good things and a lot to improve, but the first 20 minutes were very good,” said Portugal head coach Fernando Santos, who refused to give anything away about his starting line-up.
“The 23 are all ready to play, that is the most important thing.”
Portugal begin their World Cup campaign with an Iberian derby against Spain in Sochi on June 15.
Iceland, who are preparing for their first World Cup, took a 2-0 lead through goals from Kari Arnason and Alfred Finnbogason.
But Ghana replied in the second half with strikes from Kasim Nuhu and Thomas Partey.