Beaten 1-0 by first Everton and then Newcastle United in their last two home games, United survived several near-misses against the Ukrainian champions before prevailing through a second-half goal from Phil Jones.
As well as eliminating Shakhtar, the result gave United three home victories in the group phase for the first time since they last won the competition in 2007-08.
Manager David Moyes can now look forward to a favourable tie in the last 16 when the draw is made next Monday, while Shakhtar slip into the Europa League due to Bayer Leverkusen's 1-0 win over Real Sociedad in the other group game.
"We wanted to top the group and we have," said Moyes.
"I was tough with them at half-time, but we needed to be -- we need to win games. A club like Manchester United has to be trying to win the trophy; that's their job.
"You have to get better as the tournament goes on. It's a tough competition, a hard one, but we will take it one game at a time."
Shakhtar coach Mircea Lucescu said: "The first half and the second half were like two different games.
"In the first half we could easily have gone 2-0 up, but the second half was totally different. The players became tired physically and mentally, although they created a lot of chances."
Having already seen their team beaten twice in the space of a week, there was an understandable nervousness about the Old Trafford crowd that Shakhtar seemed eager to exploit.
Alex Teixeira could have put the visitors ahead in the 12th minute after running onto a pass from fellow Brazilian Taison, but he sent the ball inches wide of United goalkeeper David de Gea's left-hand post.
Andriy Pyatov had already saved from Jones by that stage and the Shakhtar goalkeeper also had to box away a half-volley from tournament debutant Adnan Januzaj, but United continued to look vulnerable.
One-time United target Douglas Costa slashed a shot wide after Alexander Buttner committed himself too early, while Alex Teixeira could only fire straight at De Gea after ghosting past Ryan Giggs, Rio Ferdinand and Jonny Evans.
Giggs and Ferdinand looked particularly ponderous, both conceding possession in dangerous positions, but gradually United roused themselves.
Wayne Rooney, back in the team after a domestic suspension, brushed the side-netting with a free-kick, while Ashley Young spurned two excellent opportunities prior to half-time.
The first saw him collect a lofted pass from Giggs before lobbing narrowly wide with only Pyatov to beat and he then sliced badly off-target with his left foot after being teed up by Rooney.
The visitors threatened again early in the second period, Yaroslav Rakitskiy seeing a shot deflected wide by Jones after a corner ran right across the United box, and news that Leverkusen had taken the lead in Spain did not aid the hosts' cause.
They improved, however, with Pyatov palming away an in-swinging Young free-kick and repelling a volley from Shinji Kagawa before Rooney feathered a chip onto the roof of the net.
Moyes's decision to introduce Robin van Persie and Tom Cleverley energised the crowd further and in the 67th minute, United scored.
Van Persie's right-wing corner took a glancing blow off a defender at the near post and sat up invitingly for Jones, who smartly readjusted his body position and lashed home a low volley.
Cleverley volleyed over as United looked to extend their lead and Van Persie dinked a shot wide in stoppage time, but Jones's strike proved enough to settle the game and begin the process of repairing Old Trafford's once formidable reputation.
Photos: Shah Rukh Khan, Rekha at a prestigious awards event
Oscars 2017: Emma Stone, Nicole Kidman, other stars on red carpet
Photos: Varun Dhawan, Alia Bhatt, Amitabh Bachchan walk the ramp
Photos: Priyanka Chopra at Oscars 2017 red carpet
Photos: Ranveer Singh, Ajay Devgn spotted at Mumbai airport