The Spaniard birdied the final two holes at Torrey Pines to complete a closing 67 and finish six under par, a shot ahead of South Africa’s Louis Oosthuizen.
Oosthuizen, who also finished runner-up in last month’s US PGA, bogeyed the 17th and needed to eagle the last for the second day running to force a play-off, but was unable to hole out from 69 yards having missed the fairway with his drive.
Rahm had just completed a third round of 64 in the Memorial Tournament to establish a six-shot lead when he was told beside the 18th green that he had tested positive for Covid-19.
That necessitated a period of self-isolation until two days before play began at Torrey Pines, where he won his first PGA Tour title in 2017 and also proposed to his wife.
Although Rahm received results of two negative tests on Friday and Saturday to allow him to leave isolation early, it was hardly the ideal way to get ready for golf’s toughest major.
Crucially, the 26-year-old handled the situation with an admirable sense of perspective, defending the PGA Tour’s decision to strictly enforce their rules and noting that he still had the positive memories of his form at Muirfield Village to draw upon.
“I’m a big believer in karma and after what happened a couple of weeks ago I stayed really positive, knowing big things were coming,” Rahm said.
“I didn’t know what it was going to be but I knew we were coming to a special place, I knew I got my breakthrough win here and it’s a very special place for my family.
“The fact my parents were able to come, I got out of Covid protocols early, I just felt like the stars were aligning.”
Rounds of 69, 70 and 72 meant he started the final round three shots off the lead but he made the ideal start with birdies on the first and second before making what would prove his only bogey of the day on the fourth.
A wild drive on the ninth looked in danger of being out of bounds, but Rahm was entitled to a free drop away from a fence and, after hitting his second shot down the fairway, spun his approach to within a few feet of the hole to set up an unlikely birdie.
A run of seven straight pars on the back nine meant Rahm still trailed Oosthuizen by a shot as he reached the last two holes, but he holed a curling birdie putt from 25 feet on the 17th and a similar putt on the par-five 18th after finding a bunker with his approach.
Defending champion Bryson DeChambeau had taken the lead with his second birdie of the day on the eighth, the American coming agonisingly close to making a hole-in-one.
However, DeChambeau imploded on the back nine with two bogeys, a double bogey on the 13th and a quadruple-bogey eight on the 17th, eventually signing for a closing 77.
Rory McIlroy’s bid for a first major title since 2014 also unravelled in the closing stages, the Northern Irishman having been part of a four-way tie for the lead following a birdie on the fourth.
McIlroy three putted the 11th and ran up a double bogey on the 12th to effectively end his chances, a closing 73 leaving him in a tie for seventh.
Earlier in the day, Phil Mickelson’s “unique opportunity” to complete the career grand slam in his home city of San Diego came to an unusual end, almost two hours before the final group was due to tee off.
Mickelson began the week with renewed hope of winning his national open for the first time, but ended it by hitting his approach to the 18th around 70 yards beyond the hole and completing a 75 to finish 11 over par.
The 51-year-old was disappointed not to have played better, but remains confident he can replicate the form which made him the oldest major winner in last month’s US PGA Championship.