The world number 25 shot a two-under 69 to win by three on 13 under from two-time defending champion Koepka.
"It was special. I never thought the tournament was over," said Woodland.
England's Justin Rose took a share of the lead with a birdie on the first hole on Sunday, but fell away with a 74 to finish on seven under par.
The 38-year-old world number four, aiming to win the second major of his career after his 2013 US Open success, carded five bogeys as he finished tied for third with Spain's Jon Rahm and Americans Xander Schauffele and Chez Reavie.
Northern Ireland's Rory McIlroy endured a turbulent final day that included double bogeys at the second and 16th, but finished with a birdie to climb inside the top 10 at five under.
Englishmen Matt Wallace, Danny Willett and Matt Fitzpatrick all ended a further stroke back.
Meanwhile, Tiger Woods began the day 11 shots off the pace and quickly slipped further down the leaderboard with four bogeys in his first six holes.
The 43-year-old, who won the Masters in April, sparked an impressive recovery as he carded six birdies to shoot a 69 and finish two under par at the scene of his record 15-shot victory in 2000.
"I was able to get it under par for the week," said the 15-time major champion. "Normally that's a good thing at a US Open, but these guys are really taking it to the golf course."
Resilient Woodland lands first major
It was a week that began so promisingly for Rose, who shot an opening-round 65 to hold a one-shot first-round lead - the joint-lowest score at Pebble Beach in the US Open, a record set by Woods when he won the first of his three US Open titles 19 years ago.
Woodland climbed into a two-stroke lead over the Englishman by the end of round two and stretched that to four strokes at one point during Saturday's third round, but Rose reeled the deficit back in to one stroke by the close of play.
And after he birdied the first on Sunday to take a share of the lead on 11 under, it threatened to be an enthralling final-day duel.
However, Koepka, who started the day on seven under, signalled his intention with four birdies in his opening five holes, as well as a miraculous par-save at the second after a wayward tee shot, to move to 11 under par.
Rose was unable to build any momentum, bogeying the second as Woodland responded with successive birdies. Koepka then dropped his first shot of the day at the eighth, minutes before Rose bogeyed the same hole, and Woodland's cushion was back to three.
Woodland had only carded two bogeys in his opening three rounds heading into the final day, but he found the rough with a loose tee shot at the ninth and was forced to lay up before falling back to 12 under.
Rose, who is good friends with Woodland, carded his worst round of the week on Sunday
The nerves appeared to be getting to the final pairing as both bogeyed the 12th and Rose fell three shots away from the lead with another dropped shot at the 13th, leaving Koepka one behind his fellow American.
But Koepka was beginning to wobble himself, scrambling to save par through his next three holes, and Woodland seized the opportunity to build a two-shot cushion with a four-foot birdie at the par-five 14th.
The 29-year-old, who won his fourth major at last month's US PGA Championship and finished runner-up to Woods at the Masters, was unable to find the birdies he craved from there on in, carding a final-day 68 to become the first player to record four rounds in the 60s and not win the US Open.
"It was some of the best ball striking I've had," said the American, who was trying to become just the second player to win three successive US Open titles, after Scotland's Willie Anderson (1903-05).
"Unfortunately I wasn't making the putts but Gary did and congratulations to him. That was a cool way to see him finish it off, and go out in style like that.
"I thought we had a game pretty early on. I closed the gap and you never know what's going to happen down the stretch. I just tried to keep the pedal down and make some putts but I didn't hole enough.
"I'm very pleased with how I played. I played my heart out. It just wasn't good enough this week."
It was left for Woodland, whose previous best finish at a major was tied sixth at last year's US PGA Championship, to finish his maiden victory in style with a 30-foot birdie at the last.
"I never looked too far ahead," he said. "Once the putt on 18 went in, I let it come out of me. It was special to finish it off here at Pebble Beach."