The two-time defending US Open champion entered day four with a two-shot lead and that was how he ended after a dramatic afternoon at Bellerive Country Club.
Koepka was caught by defending champion Justin Thomas on the front nine and Australian Scott on the way home.
But the 2013 SSE Scottish Hydro Challenge winner kept his cool to record birdies on the 15th and 16th and sign for a 66 to get to 16-under.
Woods’ 64 was his lowest-ever final round in a major and a 15 foot birdie on the last moved him one shot ahead of former Masters champion Scott, who finished at 13 under.
Spaniard Jon Rahm and American Stewart Cink were then five shots behind the winner, one clear of Thomas, Open champion Francesco Molinari, Belgian Thomas Pieters and another American in Gary Woodland.
Koepka joins Woods, Gene Sarazen, Ben Hogan and Jack Nicklaus as the only players to win the US Open and US PGA in the same season.
The 2014 Sir Henry Cotton Rookie of the Year also becomes the first player to win more than one in a season since Jordan Spieth in 2015.
“Three Majors at 28, it’s a cool feeling. It really is,” said Koepka, who missed The Masters in April through injury before coming back to make a successful defence of the US Open title at Shinnecock Hills.
“When I look at what I’ve done in the past two months, it’s incredible. Looking where I was, sitting on my couch watching the Masters, and to think I would do this, I would have laughed at you and told you there was no way, no chance, and to do it is really incredible. “My doctors, physios, trainers, everybody did an unbelievable job even to get back out on the golf course, and to do what I’ve done is very impressive. I can’t even believe it.”
Woods, who was bidding to complete one of the greatest sporting comebacks in history by claiming a 15th major title and first since 2008, failed to hit a single fairway on the front nine.
He still covered it in three under, though, and also played the back nine in three under as he backed up a strong showing in last month’s Open Championship at Carnoustie with another eye-catching effort.
“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 and am going to come up a couple of shots short.”
Spaniard Rafa Cabrera Bello and Englishman Tyrrell Hatton finished off the week tied tenth after both registering bogey-free rounds, with the duo also becoming the first European players to record final rounds of 64 at the PGA Championship.
Russell Knox, the sole Scot in the field, closed with a 68 to finish joint-35th on four-under, two shots ahead of Rory McIlroy (70).