World number 13 Scott, chasing his first win in one of the big four events, started the last round with a four-shot lead and seemed to be cruising to victory as he maintained that cushion with six holes to play.
But a late attack of the jitters saw him drop strokes at each of the last four holes to allow South African Els to slip in through the back door and lift the coveted Claret Jug with a two-under-par 68 giving him a seven-under total of 273.
It was Els's fourth Major championship, following his wins in the 1994 and 1997 US Open and the 2002 Open.
Scott's sad 75 meant he had to settle for second place on 274, three shots ahead of former world number one Tiger Woods (73), whose hopes were dashed by a triple-bogey at the sixth, and his fellow American Brandt Snedeker (74).
"I feel a little numb at the moment," the 42-year-old Els told the BBC. "I feel for Adam, he's a good friend of mine.
"I was just hoping at best to get into a playoff when I was on 17, then I birdied the 18th and then heard what happened to Adam."
Els played the best golf of all the leading players on Sunday and missed a host of birdie chances with his putter until he suddenly made a forward move by picking up strokes at the 12th, 14th and 18th holes.
The smooth-swinging South African, who said somewhat prophetically earlier in the week that he was playing well and felt "something special" was just round the corner, rolled in a 15-foot putt at the last.
Els raised his arms high into the air, high-fived his caddie and threw his ball high into the grandstand before walking off the green sporting a wide grin.
Scott, by contrast, was a picture of abject misery 20 minutes later and appeared close to tears.
A three-foot par-saving effort by the Australian had agonisingly lipped out at the 16th before he hooked his approach into thick rough at the 17th and failed to hole out from 25 feet.
Then, at the final hole, he found a deep bunker off the tee and could only move his ball a few yards forward. Bravely, he struck a sumptuous approach to eight feet but his putt rolled past the hole and victory belonged to Els.
"I am pretty disappointed," Scott said. "I managed to hit a poor shot on each of the closing four holes and they cost me bogeys. As I played so beautifully all week I shouldn't let this get me too down.
"Surprisingly, I felt incredibly calm all the way round and I still feel calm now."