Ukraine move level on points with opponents Slovakia and Romania, who play their second group-stage match against Belgium on Saturday.
Serhii Rebrov's side were below par in the first half, despite creating plenty of chances.
The decision to drop Real Madrid goalkeeper Andriy Lunin was vindicated in the opening 10 minutes when replacement Anatolii Trubin made two crucial saves.
He denied Lukas Haraslin's low-angled finish with his legs and then thwarted Schranz from close range.
Trubin was called into action again, saving David Hancko's free-kick which he palmed out for a throw-in.
Hancko took the resulting set-piece and found Haraslin who got in behind the Ukraine defence with ease and swung in a cross which was pounced upon by Schranz.
Mykhailo Mudryk initially struggled to impose himself on the game and had a wild shot when through on goal
He did improve and passed to Artem Dovbyk who performed some clever footwork in the box with his shot at the near post blocked by Peter Pekarik.
However, Ukraine's second-half showing highlighted the fighting spirit in their side as they kept going after Shaparenko's equaliser and were rewarded when Yaremchuk sealed the victory, becoming just the second Ukrainian substitute to score at a major tournament.
There were emotional scenes at full-time with Yaremchuk in tears as the Ukrainian players applauded their fans after a much-needed victory.