Fellaini, who many had considered would start the match, had only come onto the pitch five minutes earlier and was Wilmots' final substitution.
Dries Mertens' right-foot strike beat Algeria's goalkeeper in the 80th after Eden Hazard saw him free on the right and set him up for the decider. Mertens, who went on at the start of the second half, sent his shot high in the net outside of Rais Mbolhi's reach.
"We knew it would be tough, that there would be no space," Wilmots said. "We made one error and we paid for it. The bench made the difference. We showed mental strength and we came back."
The error was an obvious one. Belgium left back Jan Vertonghen dragged down Sofiane Feghouli in the area, and the Algerian attacking midfielder got up and converted the resulting penalty.
At that point, Algeria was on course to produce another upset of a major team as it did in 1982 when it beat West Germany in its first group match.
"We played a very good game against one of the favorites," Feghouli said. "We have to build on this."
The Algerians started brightly but faded toward the end against Belgium's unrelenting attack.
"We saw their strength come through. They showed that Belgium has great players," captain Madjid Bougherra said. "We lacked freshness and energy. The heat cost us."
Belgium, widely billed as the favorite in Group H, next plays Russia, while Algeria meets South Korea on June 22.
Algeria dominated possession in the opening minutes, surging forward and moving the ball with flair. Belgium eventually settled down and regained control, ending the match with 65 percent possession.
Before Belgium's comeback, the Algeria defense held firm, setting up a bulwark in the final third of the pitch. When Belgium had the ball, Algeria defenders allowed them little room to maneuver - defenders at times doubled up on Hazard, shutting down space for him to operate down the left.
"We just missed a big upset, a victory," Algeria coach Vahid Halilhodzic said. "We were so close.
"My players have no reason to blush. They may be disappointed, but there is no reason to cry."
Defensive midfielder Axel Witsel had Belgium's best two opportunities in the first half - powerful 25-yard shots parried by the Algeria goalkeeper in the 21st and 34th minutes - and also snuffed out Algeria threats by protecting the back four and winning numerous aerial duels.
Wilmots brought on Mertens for Nacer Chadli after halftime to give Belgium more of an attacking edge. He also took off lone striker Romelu Lukaku, who was left stranded and had a disappointing match, and replaced him with Divock Origi in the 58th. He made his final substitution in the 65th when he brought on Fellanini for Moussa Dembele to give the team more of a physical presence.
"We had to be patient, and we had the weapons on the bench to make the difference," Wilmots said.
Group H