UCL : Manchester City 2-0 Shakhtar Donetsk
Manchester City eventually came through with something to spare but only after a thorough examination from the Ukrainian side.
The visitors were more than a match for their hosts in the opening half but City were settled once Kevin De Bruyne scored shortly after the break.
Sergio Aguero missed a chance from the penalty spot to equal City's all-time scoring record but Raheem Sterling made the win safe in the final minute.
The visitors showed attacking intent from the get-go and they almost got in after 12 minutes, a lovely one-two in and around City's box, sending Fred charging through on goal, only for Fernandinho to make a brilliant last-ditch tackle to prevent an almost certain opening goal.
At the other end De Bruyne and Leroy Sane both came close while Marlos was denied by some alert goalkeeping from Ederson.
De Bruyne made the breakthrough in some style three minutes in the second half. He took a pass from David Silva some 25-yards and curled home a powerful right-footed shot.
That appeared to knock some of the stuffing from Shakhtar and Pep Guardiola's side took control thereafter.
Sane again went close on a couple of occasions while Aguero looked certain to score when he volleyed a pass from Silva goalwards only to see it repelled, while Sterling really should have scored from a low De Bruyne cross on 70 minutes.
Aguero's big moment arrived when Sane went over in the box under Ivan Ordets' challenge but the Argentine saw his spot-kick saved by Andriy Pyatov.
In the final minute another City sub, Bernardo Silva, picked out Sterling after cutting in from the right and the England winger crashed a shot in off the underside of the bar to ensure City made it two wins from two in the Champions League group stage for the first time in their history.