Slovakia knew victory in Duesseldorf would take them through to the knockout stage with a game to spare and they went ahead on 17 minutes thanks to Ivan Schranz, who netted the winner in the shock victory over Belgium in their opening game.
Ukraine came into this match reeling after losing 3-0 to Romania last time out but they dug deep here and equalised through Mykola Shaparenko nine minutes after half-time.
Shaparenko, of Dynamo Kyiv, then turned provider for Yaremchuk to score the decisive goal as Ukraine joined Slovakia and Romania on three points in a wide-open Group E. Romania play Belgium, who are bottom without a point, today in Frankfurt before the final round of matches next Wednesday.