William Troost-Ekong's 38th-minute header sent Nigeria ahead in the showpiece event, but Franck Kessie levelled the scores in the 62nd minute before Sebastian Haller netted the winner in the 81st minute.
Ivory Coast have secured the trophy for just the third time in their history, following on from their successes in 1992 and 2015, but it proved to be final heartbreak for three-time winners Nigeria.
Nigeria navigated their way past Cameroon, Angola and South Africa in the knockout rounds to secure their spot in the final, while Ivory Coast overcame Senegal, Mali and Congo.
These two nations met in the group stage of the competition last month, with Nigeria winning 1-0, and Ivory Coast managed to advance to the knockout round despite losing two of their three group games, including a shock 4-0 defeat to Equatorial Guinea.
Jean-Louis Gasset was sacked as head coach two days after the four-goal loss, with Emerse Fae appointed on an interim basis, and the 40-year-old has now overseen a famous win.
The temperature at kickoff was around 30C, and it was a cagey start from both sides, with neither able to carve out an opening of note in the early exchanges.
Ivory Coast actually had the first half-chance of the match in the ninth minute, but Haller just could not make contact with Simon Adingra's dangerous cross.
The hosts were dominating the match as the play progressed, with Seko Fofana drawing a smart save from Nigeria goalkeeper Stanley Nwabali during a difficult period for the Super Eagles.
Max Gradel had another half-chance for Ivory Coast in the 23rd minute, but his acrobatic effort from a corner hit the side-netting, and Nigeria were struggling to find their tempo.
Ivory Coast should have scored in the 36th minute through Adingra, but his effort was excellently saved by Nwabali, and Nigeria managed to make the breakthrough shortly after.
The hosts could only half-clear a corner to Troost-Ekong, and the centre-back's stunning header found the top corner, handing Nigeria the lead in the 38th minute.
Ivory Coast had a golden chance to level early in the second period through Gradel after a cross was deflected into his path, but somehow Troost-Ekong managed to make the block, with Nwabali then gathering.
The hosts then had a penalty shout in the 52nd minute when Gradel went down inside the box under a challenge from Zaidu Sanusi, but the referee said no and VAR agreed with him.
Jean Michael Seri sent a speculative effort wide of the Nigeria post just before the hour, before Kessie headed into the arms of Nwabali following another break down the left.
Odilon Kossounou brought another reaction save from the Nigeria goalkeeper in the 61st minute, but Ivory Coast levelled the scores from the resulting corner, with Kessie heading into the back of the net from close range.
Troost-Ekong headed over the Ivory Coast crossbar in the 69th minute, as Nigeria looked to regain the lead, but Ivory Coast remained firmly on the front foot, and a spectacular volley from Haller just missed the target in the 74th minute.
Ivory Coast were not to be denied, though, scoring a second in the 81st minute through Haller, who flicked a dangerous cross from Adingra into the top corner to spark jubilant scenes inside the stadium.
Nigeria put the pressure on in the latter stages, and seven additional minutes were added, but Ivory Coast held on to secure a famous victory on home soil in the Africa Cup of Nations.