Mozambique earned their first-ever Africa Cup of Nations win in the 17th match in their history at the tournament.