The champions looked set for a damaging draw that would have them left them at risk of a group-stage exit until Moses rose to meet Juan Mata's corner deep into stoppage time and register his first ever goal in the competition.
Chelsea had led twice, only for Shakhtar to reply on both occasions through Willian, as the Ukrainian champions threatened to inflict more misery on Roberto Di Matteo's side after their 2-1 win in Ukraine two weeks ago.
However, Moses' goal enabled Chelsea to draw level with Shakhtar on seven points in Group E, giving them a one-point advantage over third-placed Juventus ahead of what looks set to be a decisive showdown in Turin on November 20.
"We've got a crucial three points. It was crucial for us to win this tough home game," Di Matteo told Sky Sports.
"They are a very good side. Now it's probably going to go down to the last kick of the last game in this group.
"The spirit that my group showed again to keep going to the end -- we knew we had to score at the end, and we did so."
Fernando Torres received the golden boot for finishing as top scorer at Euro 2012 before kick-off at Stamford Bridge and after an early miskick in front of goal, he put Chelsea ahead in fortuitous circumstances in the sixth minute.
Yaroslav Rakitskiy's back-pass obliged Shakhtar goalkeeper Andriy Pyatov to rush his clearance and Torres capitalised by charging down the kick to send the ball bouncing into the net.
Torres tested Pyatov after skipping past Rakitskiy but Shakhtar drew level within four minutes, with Fernandinho jinking to the byline on the right before cutting the ball back for Willian to score.
Generous defending from both teams made for an open first half, with Chelsea particularly guilty of conceding possession tamely.
Shakhtar looked dangerous whenever they went forward -- testimony, perhaps, to the fact John Terry was on the Chelsea bench -- but another gaffe from their goalkeeper allowed the hosts to reclaim the lead in the 40th minute.
Pyatov raced outside his area to clear with his head but did not get enough distance on the ball and Oscar pounced in fine style, guiding home a half-volley from 45 yards to claim his fourth goal of the season in the competition.
Oscar obliged Pyatov to tip over just before the interval but it took Shakhtar just two minutes to draw level in the second half and, again, the goal came from the right.
Darijo Srna was allowed time to cross and his low cut-back allowed Willian to wrong-foot Petr Cech again, this time with his left foot.
It was no less than the away side deserved and they came within inches of taking the lead in the 54th minute, only for Razvan Rat's dipping half-volley to come back off the post.
Chelsea increased the pressure on Pyatov's goal thereafter, with John Mikel Obi seeing a header disallowed for offside and sending a volley inches wide, while Ramires felt he should have won a penalty for a challenge by Srna.
Had Gary Cahill not blocked from Adriano in the last minute, it might have been even worse for Chelsea, who appeared to have run out of luck until Moses' intervention in the depths of injury time consigned the visitors to their first defeat of the season.
"We dominated the match and had lots of opportunities to score, and I think we were better than Chelsea," said Shakhtar coach Mircea Lucescu.
"It was a pity that in the last minutes we went forward to score the third goal, because we left some spaces behind and we made a big mistake."
Mumbai food: 9 dishes to try during 9 days of Navratri
Photos: Hrithik Roshan, Nidhhi Agerwal and Adah Sharma walk the ramp
Photos: Shah Rukh Khan spotted with new set of wheels
Photos: Kareena Kapoor Khan, Kangana Ranaut at the Mumbai airport
Chris Gayle's journey from bad boy to a loving partner and caring dad