Tanzania beat rivals Uganda 3-0 in Dar es Salaam on Sunday to qualify for the Africa Cup of Nations finals for the first time since 1980.
The Taifa Stars secured the victory they needed to join already-qualified Uganda at Egypt 2019 from Group L.
Lesotho drew 0-0 in Cape Verde which confirmed Tanzania's qualification as runners-up to Uganda in the group.
It means four East African teams - Tanzania, Uganda, Burundi and Kenya - will play at the finals in Egypt.
Uganda went into the derby in Tanzania having not conceded a single goal during their entire 2019 Nations Cup qualifying campaign.
The record ended emphatically in Dar es Salaam in their sixth and final group fixture with Simon Msuva beating Denis Onyango in Uganda's goal in the 21st minute.
Experienced Erasto Nyoni added a second after the break with Aggrey Morris making it 3-0 to Tanzania on a memorable day for the hosts.
Despite the comfortable scoreline, it was still a nervous end to to the match as Tanzania's fans and players anxiously monitored news from Praia where - if Lesotho had won - their dream of qualifying would have ended.