Ukraine, who were already out, went close when Andriy Yarmolenko shot wide.
Jakub Blaszczykowski curled in a left-foot shot for the winner after 54 minutes and Poland will now play Switzerland in the last 16 on Saturday.
However, Bartosz Kapustka will miss the match in Saint-Etienne after picking up his second yellow card of the tournament.
More about: