Woods mounted a typical charge in a thrilling final round at Bellerive Country but it was fellow American Koepka who kept his nerve in the face of relentless pressure to hold him off by two shots.
Australian Adam Scott, who drew level with Koepka on the back nine, finished third, a further stroke behind.
Woods saw his chances finally recede when he could only make par on the long 17th after finding trouble off the tee while Koepka was reeling off successive birdies on the 15th and 16th to pull clear in the three-way battle for the Wanamaker Trophy.
To massive roars from the gallery, Woods birdied the final hole to complete a final round 64 for 14-under 266, confirmation that he has returned to his near best after years of setbacks and most recently injuries which threatened his career.
Koepka’s triumph comes hard on the heels of his successful defense of the US Open title in June, with a final round 66 leaving him on 16-under 264 as he claimed his third major in two years to join the very elite of world golf.
He matches legends Gene Sarazen, Ben Hogan, Jack Nicklaus and Woods, the last man to achieve the feat in 2000, in winning the US Open and PGA Championship in the same year.
“It’s mind boggling,” said the 28-year-old.
“The crowd definitely let you know what’s going on. At the beginning of the back nine I could hear the roars when Tiger started making his run and then Scotty (Adam Scott) makes his little run.
Woods, who started the tournament of the season with a bogey and double bogey, showed his fighting qualities throughout, carding his best final round in a major despite finding few fairways on the front nine.
“I didn’t drive the ball well all day,” he said. “I was hitting it left and right on the driving range, even with my sand wedge, so I knew it was going to be a struggle to piece the round together, but I did.”
Behind the three frontrunners, Spain’s Jon Rahm and Stewart Cink finished tied for fourth on 11-under, while defending champion Justin Thomas faded to finish a shot further back with British Open winner Francesco Molinari, Thomas Pieters and halfway leader Gary Woodland.
Spain’s Rafael Cabrera Bello and Tyrrell Hatton of England carded joint best of the day 64s with Woods to close on nine under, giving early notice of a low scoring day.
Rickie Fowler, who led on an emotional first day as players remembered Australian golfer Jarrod Lyle, who died of cancer aged 36, again faltered in his challenge for a major to finish in a group on eight-under which included Jordan Spieth.