In Uyo, 20-year-old George Ilenikhena scored on his Nigeria debut just before half-time to cancel out Ehsan Kari's 16th minute opener for Madagascar.
Midway through the second-half, Moses Usor struck the winner for Eric Chelle's side who next face Guinea-Bissau.
They started their bid to reach the continent's most prestigious national team tournament with a 2-0 win against co-hosts Tanzania.
Franculino and Mama Baldé scored the goals that put them top of Group L.
Pressure of coaching Nigeria 'on another level', says Chelle
Under competition rules, Tanzania, Kenya and Uganda will play against the other teams in their pools but are assured of their place in next year's tournament as co-hosts.
Only one other side in those three groups will advance to the 24-team tournament which is scheduled to take place between 19 June and 17.
Egypt, Senegal, Morocco and Nigeria start quest for AFCON 2027
In the nine other groups, the top two teams will progress.
Mozambique mar Vieira's debut
Senegal, whose football federation is contesting the decision to strip the team of the 2025 Africa Cup of Nations at the Court of Arbitration for Sport, fluffed Patrick Vieira's international coaching debut.
The 50-year-old, who was born in the Senegalese capital Dakar before his family moved to France, replaced Pape Thiaw as head coach during the summer.
His side opened the scoring through Nicolas Jackson in the 33rd minute in Maputo.
But Geny Catamo levelled for Mozambique on the stroke of half-time.
Senegal could not force the winner despite dominating possession. In the other game in Group I, Sudan edged past Ethiopia 1-0.
In Group B in Cairo, Egypt and Angola played out a goalless draw as Malawi took initial command of the pool with a 2-1 win over South Sudan.
Morocco start with victory
Morocco, awarded the 2025 Cup of Nationsafter organisers ruled Senegal had flouted competition rules by walking off the pitch during the final last January, began their Group A campaign with a 2-0 win over Gabon in Rabat.
Noussair Mazraoui scored his third goal for Morocco to give them the lead at the Stade Prince Moulay Abdellah in Rabat.
Gabon, who were playing for the first time under new coach Sébastien Migné, kept within range of the hosts until Soufiane Rahimi secured the three points six minutes from time.
In Group A's other game Niger dispatched Lesotho 2-1.



OSP must publish findings on alleged sale of diplomatic passports – Larry Dogbe
2027 Budget: 'Adwuma no wɔ he?’ – Sammi Awuku demands answers on Mahama's youth ...
SA evacuation: OSP must punish those who took hotel money while evacuees slept i...
Ghana, Slovakia consider visa waiver deal for diplomatic, service passport holde...
World Cup visa scandal: OSP must not end at announcement of probe – Ekow Assafua...
SA evacuation: I’m convinced OSP will find nothing untoward after probe – Batagl...
'If by close of today Erastus Asare Donkor fails to come and apology we will cur...
Both sides of Parliament support GH¢10m Media Development Fund – Bunkpurugu MP
SA Evacuation: If Ablakwa wanted Ibrahim Mahama’s GH¢16m, he wouldn’t make it pu...
Ato Forson explains why gov’t won’t borrow to finance New Economy Programme
