Woods, who had led DiMarco by three strokes going into the final round, sank an 18-foot birdie putt at the first extra hole to secure his fourth green jacket and 43rd PGA Tour victory.
As the winning putt dropped at a sun-drenched Augusta National, he broke into a smile and punched his right fist triumphantly into the air.
"This is special," said the 29-year-old American after ending a barren run of 10 majors since his previous triumph at the 2002 U.S. Open. "To hit two of the best golf shots I hit all week on that first extra hole was pretty sweet."
Woods struck a perfect three-wood off the tee on the 18th hole and followed with an eight-iron approach into the heart of the green to set up the victory putt.
"I've kind of battled the last couple of years," he added. "I've been working hard on my game and made some changes but I wasn't winning major championships.
"I contended a couple of times and didn't win but, for the most part, I wasn't in contention on the back nine of a major, which is where you want to be."
Woods, who had led by two strokes with two holes remaining in regulation play before producing a bogey-bogey finish, reclaimed the world number one ranking from Vijay Singh with his victory.
Woods, after a 71, and DiMarco, after a 68, had finished level at 12-under 276 after 72 holes.
DiMarco struck the flag at the last with a chip from in front of the green for the birdie-three that would have secured him the title.
Woods appeared to have set up his third PGA Tour title of the year in regulation by producing a miracle birdie at the par-three 16th, holing out from 40 yards off the green with a delicate chip that fed back 25 feet down the slope.
Errant tee shots on 17 and 18, however, let DiMarco back in before the dramatic finish.
With the win, Woods drew level on nine grand slams with fellow American Ben Hogan and South Africa's Gary Player in the all-time listings.
U.S. Open champion Retief Goosen, whose 67 was the best score of the final round, tied for third at five-under 283 with Britain's Luke Donald, who eagled 13 and 15 on his way to a 69.
Birdies at the first two holes of the final round had put Woods four shots clear before he slipped back with a three-putt bogey at the par-four fifth.
Although he also birdied the par-four ninth to reach the turn three clear at 13 under, he stumbled again at the par-four 10th after duffing a chip from just off the green.
American Ryder Cup player DiMarco, who had narrowly missed birdie putts on three, four and five, then holed a 35-footer at the par-four 11th to trim Woods's lead to just one.
LOST GROUND
DiMarco lost ground at the very next hole, the par-three 12th, when he was unable to get up and down from the back left fringe to save par. Woods, who parred, was once again two clear.
At the par-four 14th, DiMarco once again cut the lead to one after hitting a superb approach to within two feet.
Three ahead of the field after completing a seven-under-par 65 earlier in the day in the weather-delayed third round, Woods knew he had a battle on his hands with DiMarco's approach play in sparkling order.
Although Woods produced his moment of magic at the 170-yard 16th to forge two strokes clear, DiMarco's rock-steady play set up the gripping finish.
"Chris is a fighter," Woods said. "The guy got out there and grinded his way round the golf course. He shot 68 today, and that's some pretty good playing."
Despite opening with a two-over-par 74 in the thunderstorm-hit first major of the year, Woods swept to the top of the leaderboard with scores of 66 and 65 in the next two rounds.
His sparkling 65, joint best score of the week, included a record-equalling run of seven birdies from the par-four seventh.