Nigeria fell behind in the 17th minute when Ehsan Kari headed Madagascar into the lead from a short corner routine, leaving goalkeeper Stanley Nwabali with little chance.
The hosts responded before half-time, with George Ilenikhena drawing Nigeria level in the 45th minute. The forward ran on to a pass, moved towards the centre of the box and fired a low effort into the bottom-left corner.
The Super Eagles returned for the second half with greater urgency and continued to press the Barea backline.
Moses Usor completed the turnaround in the 63rd minute after replacing Samuel Chukwueze alongside Moses Simon, who also came on for Akor Adams.
Nigeria had earlier thought they had taken the lead when Alex Iwobi found the net in the 33rd minute, but the goal was ruled out for an earlier infringement on the Madagascar goalkeeper.
Madagascar threatened to restore their lead early in the second half when Rayan Raveloson broke through after Calvin Bassey lost possession. Raveloson attempted to round Nwabali, but the Nigerian goalkeeper stood his ground and took the ball off him.
Akor Adams then had an opportunity at the other end but rushed his effort and sent it wide.
The Super Eagles continued to control possession as the match progressed, looking for a third goal, while Madagascar were forced to defend deep.
Nigeria's victory gives Eric Chelle's side three points from their opening Group L fixture. Tanzania, who are co-hosts of the 2027 tournament, already have an automatic place at the finals, meaning the remaining teams in the group are competing for the available qualifying berth.
The Super Eagles will travel to Guinea-Bissau for their second qualifying match on Tuesday, September 29.
Chelle had called for Nigeria to start the campaign strongly, saying, “We must go for the points without any hesitation.”

Discussion0