It was a blistering and roller coaster game with Tanzania coming back from 3-1 down to take the lead before Nigeria fought back again and regained the lead.
Nigeria first took the lead through Olatomi Olaniyan in the 21st minute but Tanzania responded immediately with an equaliser.
The Golden Eaglets the took control of the game and ran into a two-goal lead through goals from Wisdom Ubani and Akinkunmi Amoo in the 31st and 37th minute.
Nigeria started the second half as they ended the first but they blew two good chances before Kelvin John pulled one back for Tanzania who ran into a 4-3 lead with two debatable penalties to turn the game around.
The game which will go down as a U17 AFCON classic got another twist as the Golden Eaglets got the equaliser to make it 4-4 through Ubani before Ibraheem Jabaar fired in the winning goal in the 79th minute.
Nigeria will next face Angola in their next group game on Wednesday, April 17.