Chasing 277 on a snakepit of a pitch, England looked all but beaten at 117-5, only for Woakes and Buttler to counter-attack in a partnership of 139.
Buttler was lbw reverse-sweeping Yasir Shah for 75 with 21 still required and the second new ball due.
The promoted Stuart Broad took England to within four, which Woakes got from an outside edge to end 84 not out.
It was Woakes who said on Friday night that England would draw on their experience on recent unlikely victories, and this latest success follows the drama of the World Cup final and the Headingley Ashes Test.
Not only were they second favourites for most of this fourth day, but also after conceding a 107-run first-innings lead after errors in the field, poor tactics and a top-order collapse.
They gradually battled back over the final two days, yet it was only when Buttler and Woakes were together that Pakistan’s energy was replaced by trepidation.
England win the opening match for the first time in six series and can earn their first success over Pakistan in 10 years if they win the second Test in Southampton, which starts on Thursday.
England pull one out of the fire
This was a classic finish to a gripping Test, one that in another time would have had an empty Emirates Old Trafford bouncing in Saturday revelry.
England were rightly criticised for their performance over the first two days – wicketkeeper Buttler’s pair of reprieves that allowed Shan Masood to make 156, captain Joe Root’s tactics, some feeble batting.
But the way they battled in the second half of their first innings was brave, their bowling in Pakistan’s second innings was tenacious and the match-winning Buttler-Woakes partnership was nerveless.
They made light of a surface that was turning, spitting and rearing to help England to the second highest run-chase ever completed to win a Test on this ground.
Buttler could barely watch as the third umpire took an age to confirm his dismissal, but that only led to the bold promotion of Broad.
However, it was fitting that Woakes, so often an unsung hero, hit the winning runs, celebrating with a roar that echoed around the empty stadium.
Woakes and Buttler take England home
Buttler famously has an irreverent slogan written on the handle of his bat. It is an approach that served him well in a situation where he may have been playing for his place after the keeping errors and a lean run with the bat.
What made the sixth-wicket stand all the more remarkable is what had gone before. England had lost 3-20 after Naseem Shah got one to lift at Joe Root, Yasir’s fizzing googly took the glove of Ben Stokes and Ollie Pope had no chance in the face of an unplayable lifter from Shaheen Afridi.
Buttler and Woakes decided that attack was the best form of defence. Buttler went after leg-spinner Yasir with drives, sweeps and reverse-sweeps. Woakes slapped the pace bowlers through the covers.
The 50 partnership came in 49 balls. Pakistan retreated and the pitch went to sleep. The metronomic Mohammad Abbas was ineffective.
The strokeplay gave way to steady accumulation, tension rising as the scoring slowed. Buttler freed the shackles by heaving Shadab Khan for six, but was out in the following over.
Broad swiped seven useful runs, then Woakes’ edge to third man sealed victory in the glorious evening sunshine.
Pakistan fall at the last
Pakistan had been in control for so long thanks to their determined first-innings batting, relentless bowling and enthusiasm in the field.
The tourists showed togetherness throughout, their reserve players making noise from the balcony of the hotel that overlooks the ground.
They took the initiative at the start of the day, extending their lead by 32 runs in 16 chaotic deliveries that also included the fall of the final two wickets.
But Pakistan immediately seemed intimidated by Buttler. The field spread, pressure was released and runs were much easier to come by.
Captain Azhar Ali burned his reviews in desperation before Yasir struck late to remove Buttler and Broad.
Pakistan buzzed and chatted to the end, but ultimately lost a match they should have won.