Golden Boot winner Aymen Mahious had a chance to win a competition reserved for footballers playing in their country of birth when he stepped forward to take the 10th spot-kick.
But his attempt was weak and straight at goalkeeper Pape Sy, who saved comfortably, leaving the teams deadlocked at 4-4, and necessitating a sudden-death extension to the shootout.
Ousmane Diouf calmly converted to edge Senegal ahead amid whistling from many in a sell-out 39,120 crowd at the Stade Nelson Mandela in Algiers.
Ahmed Kendouci had to score to keep Algerian hopes of victory alive, but his shot rebounded off the crossbar and Senegal were champions.
The local-based team triumphed a year after the full Senegal team, including stars like Sadio Mane, beat Egypt on penalties to win the premier competition, the Africa Cup of Nations.
It was a joyous occasion for all of west Africa as teams from the region reached five of the other six Nations Championship finals and lost them all.
This was the second final to be decided by a shootout with Libya beating Ghana on penalties after a goalless 2014 title decider in Cape Town.
Regular and extra time in a tense, physical Algiers showdown were notable for the lack of goal attempts with just four in 120 minutes, three of them from Algeria.
The attempt that came closest to breaking the deadlock was in the 107th minute when a volley from Houssem Mrezigue was brilliantly pushed over by Sy.
An unusual fact was that neither team was caught offside during the cagey 120-minute attritional battle, while each side received four yellow cards.
Morocco, the Democratic Republic of Congo (twice each), Libya and Tunisia won previous editions of the national team competition.
There was also drama in the third place playoff in the western city of Oran on Friday with a 90th-minute goal from Jean-Yves Razafindrakoto earning Madagascar a 1-0 win over Niger.