Hadley said he was "sick and tired of playing like an idiot" when he arrived in the Caribbean, so he did something about it, leading throughout the final round on the Trump International course in Rio Grande.
The American shot five-under-par 67 in his final round on Sunday but it was far from a cakewalk to victory as New Zealander Lee birdied the 13th, 15th and 16th holes to close the margin to one stroke with two holes left.
Hadley, however, responded in style with birdies at the final two holes to finish at 21-under 267 for his first tour victory at the age of 26.
Lee (68) birdied the last to finish second on 19-under, with American Ben Martin (66) third on 17-under.
Hadley, who came into the event ranked 92nd in the world, collected $630,000 and a two-year exemption on tour.
He was extremely nervous before the final round and had trouble eating, but a prayer session proved calming, as did an unlikely chip-in birdie at the fifth hole.
"That shot won me the tournament," the North Carolinian told reporters. "I was dead over there and I hit the nastiest little nipper and it snuck in the left door."
Hadley had a poor final round at the Honda Classic last week, after which he admonished himself.
"I went back to my hotel room and just let it all out," he said.
"From there on I just figured it out and golf's fine now. That just shows how quickly it can change."
Runner-up Lee took plenty of positives from his best result on the tour.
"I gave it my best but Chesson was just playing rock solid,"
said Lee, who in 2008 at the age of 18 became the youngest player to win the U.S. Amateur Championship.
"He made a couple of good up-and-downs and when he plays like that it's just really hard to catch."
The Puerto Rico Open was contested by players who did not qualify for the WGC-Cadillac Championship.
(Reporting By Andrew Both in Cary, North Carolina; editing by Julian Linden)