SAN DIEGO, Calif. (Reuters) - Jon Rahm became the first U.S. Open champion from Spain when he finished with two brilliant birdies to outlast Louis Oosthuizen by one stroke at Torrey Pines on Sunday.

An emotional Rahm quickly dedicated the victory to his late compatriot Seve Ballesteros, the man who put Spain on the golfing map by winning five major titles before dying of brain cancer at age 54.

"This is definitely for Seve. I know he wanted to win this one most of all," said Rahm, his voice cracking with emotion.

Rahm edged South African Oosthuizen in a wild battle of attrition that finally turned into a two-man race as several other contenders came unglued on the difficult back nine.

Rahm was the only serious contender to avoid a bogey on the inward half, and he timed his run perfectly by sinking lengthy, sharply-breaking putts at the 17th and 18th holes.

Newsletter signup for email alerts

He shot 67 for a 6-under-par 278 total, and was confirmed as the champion when Oosthuizen was unable to eagle the par-5 18th.

The win comes a fortnight after Rahm was withdrawn from the Memorial tournament after testing positive for coronavirus before the final round. He had a six-shot lead at the time.

While Rahm celebrated, Oosthuizen pondered another major near-miss.

Though he birdied the final hole for a 71, it was another bitter pill for the likable South African, who also finished runner-up at last month's PGA Championship, and now has six career second-placings in the four tournaments that comprise the grand slam.

At least Oosthuizen, apart from a poor drive at the penultimate hole that led to an ultimately very costly bogey, held his game together down the stretch, unlike several other heavy hitters.

Bryson DeChambeau and Rory McIlroy were among the biggest names who came unglued on the most difficult stretch of the course early on the back nine.

Defending champion DeChambeau began the final round two shots back and set himself up to be a repeat winner when he nearly made an ace at the par-3 eighth, his ball stopping an inch shy of dropping in.

Still, the tap in birdie was enough to give him the sole lead at the time.

But DeChambeau blew any chance of holding on by hitting a series of wayward drives and poor putts starting at the 11th, dropping four shots in three holes to plunge out of contention.

McIlroy also fell back with a double-bogey at the 12th hole, where his approach shot plugged in a greenside bunker.

He eventually tied for seventh.

It came down to the two men at the top.

Rahm tied Oosthuizen for the lead by sinking a 25-footer at the 17th.

And his putter stayed hot at the par-5 18th, where he coaxed home a 20-footer on the same green where Tiger Woods famously birdied the last 13 years ago to get into a playoff that he subsequently won.

Back on the course, Oosthuizen after a bogey at the 11th settled down and sank a series of testing par putts to tick off the holes without any damage.

He was on the 15th hole when Rahm holed out at the last, and could hardly ignore the ear-splitting roars that greeted the Spaniard's heroics.

Still one back at the par-4 17th, Oosthuizen hooked his drive into a hazard, his ball not listening as he pleaded with it to "slide, slide."

Even after a penalty stroke he still had a chance of salvaging par, but when a 10-foot putt trickled wide he was in need of a miracle at the last.

It was not to be, allowing 26-year-old Rahm to join Ballesteros, Jose Maria Olazabal (two) and Sergio Garcia (one) in the elite group of major champions from his European nation.