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.



Police interdict seven officers over alleged extortion in Accra
27-year-old nursing mother shot dead along Tilli–Widnaba road
Ghana to reopen diplomatic mission in Ireland
Ghana facilitates return of 180 nationals from Libya
Parliament to review dollar payment for locally produced crude
Ghana to build 1,200MW gas-fired power plant, surpassing Akosombo capacity befor...
“Those responsible should be imprisoned for life with no food” — Friend of murde...
“I have crocodile skin; insults don’t bother me” — President Mahama
Police arrest 64 suspects, recover firearms in special operation at Achimota Mil...
Madina MP receives medical attention after GIMPA collapse
