Victory for the Selecao is their first in four games, setting them up nicely for their opening World Cup fixture against Iberian rivals Spain in eight days' time.
Cristiano Ronaldo was wayward with his first shot of the game but fared better from the second as he tucked the ball out of Salhi's reach, only for the offside flag to deny him another international goal.
The European champions did not have to wait much longer for their breakthrough moment, though, thanks to a fine finish from Premier League-linked Guedes into the bottom corner after Bernardo Silva headed a long ball into his teammate's path.
Ronaldo picked out the side-netting two minutes later when Guedes was open for a tap-in, but Portugal did claim a second goal before the interval.
Fernandes got off the mark with his first senior goal, showing good desire to get between two opposition men and guide Ronaldo's left-sided cross out of Salhi's reach.
Portugal perhaps should have added a third on the brink of half time, with Fernandes failing to pick out a teammate when it would have been easier to shoot, while Bernardo Silva slotted the ball wide from a good position.
Algeria registered just one shot of any note in a first half that saw them completely dominated - Yacine Brahimi's 20-yarder deflecting wide 45 minutes in - as Rabah Madjer's choice to go with a five-man backline failed to pay off.
The visitors, now beaten in their last four matches, performed just as badly in the early stages of the second half as Portugal put the game to bed.
Ronaldo had two shots kept out by Salhi, the latter from a long-range free kick, before Guedes strengthened his claim for a starting spot at the World Cup by meeting Raphael Guerreiro's cross and powering home a header.
Guedes could have added a fourth international goal to his tally when played through three minutes later, but he was unable to keep his shot on target from a one-on-one position.
Ronaldo then failed to square the ball to Guedes from the next attacking move and the Selecao's grip on the game did loosen slightly once a flurry of subs were made.
Fernando Santos, taking charge of his 50th Portugal game tonight, decided to leave Andre Silva - a likely starter in the World Cup opener against Spain - on the bench until the final quarter of the contest.
Joao Mario was another late substitute for the hosts, and the Inter Milan attacker thought that he had put the icing on the cake by converting Fernandes's cross from a couple of yards out.
A whole two minutes after the ball crossed the line, however, English official Craig Pawson ruled the goal out via the use of VAR due to a handball infringement from Guedes in the build-up.
Bounedjah nearly netted a consolation for the African side from the final meaningful act of the game, directing a back-post header on target for Patricio to help it over the crossbar.
PORTUGAL (4-2-3-1): Patricio; Soares, Pepe, Alves (Fonte 57'), Guerreiro (Rui 57'); Carvalho (Quaresma 64'), Moutinho (Joao Mario 75'); Bernardo Silva (Adrien Silva 67'), Fernandes, Guedes; Ronaldo (Andre Silva 74')
ALGERIA (5-2-3): Salhi; Ferhat, Bensebaini, Mandi, Medjani (Bounedjah 71'), Benmoussa; Bentaleb, Boukhanchouche (Benkhemassa 57'); Mahrez, Slimani (El Arbi Soudani 86'), Brahimi