Koepka lifted the US Open earlier this season and has become the first player to win both since Woods did the same in 2000.
Koepka carded a closing 66 in a breathless final round at Bellerive Country Club to finish 16 under par and two shots ahead of Woods.
After becoming the first player in 29 years to win back-to-back US Open titles at Shinnecock Hills in June, Koepka has now won three of his last six major starts, a wrist injury having forced him to sit out the Masters in April.
These four days will also be remembered for an extraordinary performance by Woods, who threatened to complete one of the greatest sporting comebacks in history by claiming a 15th major title and first since 2008.
Woods failed to hit a single fairway on the front nine though that didn’t stop him as he still covered it in three under. Woods kept going on the back nine to card a remarkable 64 which surely ended any lingering doubts about his ability to win again.
“I was in contention the last two majors and would never have foreseen that a year ago and I’m just so thankful to be here,” Woods said.
“I played hard. It was a bit of a struggle with my game today. I was just hanging in there, grinding it out and trying to make as many birdies as possible. I made a little bit of a run but came up a couple of shots short.”
Woods began the day four shots off the lead in a tie for sixth, exactly the same position he was in after 54 holes of the Open, where he would move into a one-shot lead with eight holes to play before fading to sixth.
The 42-year-old, who only returned to competitive action in November after spinal fusion surgery last April, missed from seven feet for birdie on the first but converted from three feet on the second and almost holed his tee shot on the third to set up another gain.
A bogey on the sixth was followed by birdies on the eighth and ninth, despite wild tee shots on both occasions, to close within one, but Koepka responded to dropped shots on the fourth and fifth with a hat-trick of birdies from the seventh to restore his two-shot overnight lead at the turn.
Woods finally found the fairway on the 10th and 11th but failed to birdie either hole, his birdie putt on the latter agonisingly stopping on the edge of he hole and refusing to drop in.
There were no such issues on the next as Woods holed from five feet, although he did have to wait for the hole to be repaired after it was damaged by the approach of playing partner Gary Woodland.
And when he holed from twice the distance on the 13th, the deafening roar told everyone on the course that Woods was just one shot off the lead alongside Australian Adam Scott, who had birdied the 10th and 12th.
Scott then moved into a share of the lead as he birdied the 13th and watched Koepka miss from closer range, while Woods bogeyed the 14th after finding heavy rough off the tee and failing to get up and down from right of the green.
That proved to be just a temporary blip in the amazing display Woods was producing, a drive of 330 yards down the 15th being followed by a pinpoint approach from 164 yards which pitched and stopped just a foot from the hole.
But just when he needed another similar drive on the par-five 17th, Woods sliced his tee shot almost into the creek which runs down the right side of the hole.
Although it was not in the water it did land inside the hazard and he could only chop it back on to the fairway and eventually save par from a greenside bunker, but Koepka had crucially birdied the 15th and 16th to restore a decisive two-shot cushion.
Scott bogeyed the 18th to drop out of a tie for second, with Stewart Cink and Jon Rahm two shots further back in a tie for fourth.