Jordan Ayew's superb solo goal helped Ghana overcome an unimpressive start in the Africa Cup of Nations to beat Guinea-Bissau 2-0 and top Group F.
Ayew broke down the left wing, skipped past a defender and curled a shot into the far top corner to give Ghana the lead in the first minute of the second half.
Thomas Partey added a second when he forced in a cross from close range in the 72nd minute as Ghana secured their first win at the tournament.
The four-time champions began the tournament with two draws and under threat of not qualifying for the last 16, but victory saw them emerge as group winners after defending champions Cameroon failed to beat Benin.
Cameroon stutter into last 16
Cameroon's 0-0 draw in Ismailia had repercussions beyond the group stage as finishing second in Group F means a last 16 encounter with Nigeria.
The draw also saw Benin through as one of the best third-place teams, the first time the West African nation has made it past the group stages at the tournament.
Mali, Tunisia qualify from Group E
Mali secured top spot in Group E of the Africa Cup of Nations after a 1-0 win over Angola, who failed to progress to the knockout stage.
Angola threatened early on when Gelson Dala went through, but could not beat goalkeeper Djigui Diarra.
At the other end, Toni Cabaca saved well from first Adama Traore and then Falaye Sacko before Mali striker Kalifa Coulibaly nodded just wide from a corner.
The West African side, though, took the lead in the 37th minute through a long-range effort from RB Leipzig midfielder Amadou Haidara.
Mali progress to a second-round showdown against the Ivory Coast in Suez on July 8, while Angola head home.
Tunisia went through as runners-up despite a goalless draw against Mauritania, and will next play Ghana.
Tuesday's results also mean South Africa edge into the last 16 after ranking fourth out of the best third-placed teams, which will see the Bafana Bafana take on hosts Egypt in Cairo on Saturday.