The win - City's biggest in the Champions League - is not enough to guarantee a place in the knockout stages, but Pep Guardiola's team only require one point from their remaining two matches in Group F.
Man City attempted to assert themselves during the opening stages of the match, but it was Shakhtar who created the first opportunity with Junior Moraes seeing a tame effort comfortably dealt with by Ederson.
However, the home side would soon take the lead through David Silva, with Mahrez twisting and turning on the right-hand side of the penalty area before giving the Spaniard the chance to tap home from close range.
Bernardo Silva had a weak strike from distance easily dealt with by Andriy Pyatov, but City doubled their advantage shortly after the midway point of the first half, albeit in controversial circumstances.
A penalty was awarded when Sterling tumbled inside the area, but replays showed that the Englishman went down after tripping up over his own foot rather than due to any contact from Mykola Matviyenko.
Jesus stepped up to send the resulting spot kick to Pyatov's right, and it left City in cruise control for much of the remainder of the first half.
Shakhtar's Serhiy Bolbat should have done much better with a half-volley from 12 yards out, but the visitors were struggling to mount any kind of sustained pressure on their hosts.
Both teams were content to play at a slow pace after the restart, but Sterling soon had the crowd on their feet with a delightful goal from distance for his first in the Champions League this season.
The winger accelerated from two Shakhtar players to give himself the chance to move towards goal, and the Englishman reached the edge of the penalty area before finding the far corner of the net from 20 yards out.
The goal effectively ended the match as a contest and it was soon being played at the pace of a friendly fixture, although City continued to probe for a fourth.
That finally arrived in the 72nd minute after David Silva was upended by Taras Stepanenko inside the penalty area, and Jesus netted his second of the game by firing the ball into the top corner.
Shakhtar had offered very little in an attacking sense, but Ederson was required to dive to his left to prevent a 25-yard free kick from Yaroslav Rakitskiy from finding the corner.
City were going through the motions as the game approached the full-time whistle, but a fifth goal arrived six minutes from time when Mahrez sent a tame volley from the right-hand side of the area under Pyatov and inside the near post.
Jesus managed to completed his hat-trick with what was effectively the last kick of the game, with the striker latching onto a long pass from Mahrez before delicately chipping Pyatov - who was out of his goal - from 35 yards.
The sixth capped off the easiest of wins for City, who will now look to seal top spot in their next fixture in Lyon at the end of October.
MANCHESTER CITY (4-2-3-1): Ederson; Walker (Danilo 61'), Stones, Laporte, Zinchenko; Fernandinho (Delph 76'), Silva (Gundogan 73'); Mahrez, Bernardo, Sterling; Jesus
SHAKHTAR DONETSK (4-2-3-1): Pyatov; Matviyenko, Kryvtsov, Rakitskiy, Ismaily; Stepanenko, Maycon (Alan 77'); Taison (Nem 77'), Kovalenko, Bolbat; Junior Moraes (Kayode 63')