Qualification was in the balance for Kwesi Appiah's men after draws from their opening two games and they took a while to settle at Suez Stadium.
Ayew's second of the competition gave them a 46th-minute lead but Guinea-Bissau could rue hitting post and bar three times over the course of a contest that meant their tournament ended with a solitary point.
Atletico Madrid midfielder Thomas Partey finished from close range with 18 minutes to play, putting Ghana ahead of Cameroon, also on five points from three games, on goals scored.
Guinea-Bissau almost lead in the 17th minute when Ghana goalkeeper Richard Ofori unconvincingly tipped Piqueti's rasping strike against his crossbar.
It was the Black Stars' turn to be frustrated in the 36th minute as Mubarak Wakaso brilliantly released Jordan Ayew with a lofted pass and the forward steered the ball against the base of Jonas Mendes' right-hand post.
A sumptuous cross from Ghana winger Samuel Kwame Owusu was headed wide at the back post by Owusu Kwabena, although the breakthrough arrived half a minute after the restart.
Ayew was allowed space on the left-hand side of the Guinea-Bissau box to curl into the top corner.
Joseph Mendes fired against the outside of the right post from the edge of the Ghana box as the Djurtus almost hit back swiftly.
Ofori pushed Mamadu Cande free-kick behind in the 64th minute and the resulting corner came back off the bar.
Ghana made the most of their good fortune as Baba Rahman stayed onside and cut the ball back across goal to give Thomas a simple finish.
Ayew was denied by the post once more and appears in fine form ahead of a last-16 encounter with the eventual runners-up in Group E.