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 sensational 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.
And 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 ever major winner in last month's US PGA Championship.
"There's some opportunities coming up with the way I've been playing that I'm optimistic that I can compete and contend," the six-time major winner said.
"There's nothing more fun for me than to be in it on the weekend. I've actually been playing well enough to have chances, and we have some good tournaments coming up the next couple of months.
"Afterwards I'll look back and reminisce when the season's over and I'll still have that Wanamaker trophy I'll be looking at, and I'm still looking to add a friend to it along the line.
"That win was very meaningful to me because I've been putting in a lot of work the last couple of years and getting nothing out of it, and so to have a moment like that is something that makes it worthwhile."