Root, unshackled from leadership duties, finished on 115 and Foakes was 32.
The hosts' balcony erupted in joy — the visitors' balcony lay vacant.
England had only once chased more than 277 to win at the venue. That came in pursuit of 282, also against New Zealand, in 2004.
No-one needed to count the boundaries as they did in the 2019 World Cup final, although that was a key part of the diagnosis to New Zealand's defeat. Fifty runs from the top four batters across two innings was an anaemic return.
The defeat of the test world champions marks a coup for the new Brendon McCullum and Ben Stokes coaching and captain era and the return of veterans James Anderson and Stuart Broad.
New Zealand's hunt for their second victory at Lord's across 91 years to emulate the 1999 pioneers goes on.
Captain Kane Williamson rotated the wily Tim Southee, shrewd Trent Boult and aggressive Kyle Jamieson to no avail.
The fielding was sharp, including Cirque du Soleil-like performances on the hallowed turf from Southee, Devon Conway and substitute fielder Michael Bracewell, but no match for Root and Foakes' precise and patient approach.
The pair picked off singles and twos at will, as if reverting to white-ball tactics without taking any unnecessary risks. They expanded into the boundary market later.
Root was expected to perform the role of a human bollard with his innate timing and balance. The innings saw him clip Southee into the legside to simultaneously bring up his 26th test century and become the 14th batter to 10,000 test runs.
Foakes, who scored a century on debut away against Sri Lanka in 2018, offered just as much composure in his 12th test, coming off a series of impressive innings for Surrey.
The match felt like a day-nighter to start. The lights were on under elephant-coloured skies as the heat in cricket's most renowned cauldron appeared to burn off any lingering drizzle looking to invade St John's Wood.
Until the result, both sides were effectively ahead three times each in the game.
England reduced New Zealand to 45 for seven in the first innings on the way to eventually dismissing them for 132; the hosts were 59 without loss in the second; and they had the visitors 56 for four with a lead of 47 in the third.
However, the New Zealand resolve was indelible.
First, through Colin de Grandhomme's 42 not out. Without that, the first innings would have dissolved into a pool of mediocrity.
Second, the response of the bowling attack, working in partnerships to raze any potential England first-innings advantage by taking five wickets for eight runs in 28 balls to move from 92 for two to 100 for seven.
Third, the 195-run fifth-wicket record stand for New Zealand against England between Daryl Mitchell and Tom Blundell, which marked a monumental recovery in the context of the match.
In the end, England survived best.