AP photo by Eric Risberg / Daniel Berger reacts after making an eagle putt on the 18th green at Pebble Beach Golf Links to win the AT&T Pebble Beach Pro-Am on Sunday in California. It was his fourth PGA Tour victory.

PEBBLE BEACH, Calif. — For all the stunning views that can be so soothing at this Pacific Coast course, Daniel Berger couldn't escape the tension when he arrived at the final hole Sunday in the AT&T Pebble Beach Pro-Am.

He was tied for the lead, needing a birdie on the par-5 18th to win. Off to his right were out-of-bounds markers below a row of hedges, where Berger hit a drive Saturday that led to a double bogey at Pebble Beach Golf Links. To his left was the ocean.

"I was going to go down swinging," he said.

Berger went up instead.

Two of the best swings of his career — a driver into the fairway and a 3-wood from 250 yards away in the cool air at sea level — left him 30 feet and two putts away. Berger capped it off with an eagle putt for a 7-under-par 65 and a two-shot victory over Maverick McNealy, who closed with a 66.

"To step up there and hit a great drive and then one of the best 3-woods I've ever hit in my life, and then to make that putt is just as good as it gets for me," said Berger, a 27-year-old Floridian who finished at 18-under 270 for the fourth victory of his PGA Tour career.

Berger started his final round with a 4-iron shot that left him 20 feet for eagle on the par-5 second hole to catch up to 54-hole leader Jordan Spieth in no time at all. And while the cast of contenders kept changing, Berger was never out of the mix until he had the final say with one last eagle, his fourth of the week.

Spieth went from leading to lagging behind. He started with a two-shot advantage and was three shots behind after six holes, wasting the scoring stretch at Pebble Beach. He finished with two birdies for a 70 and tied for third with Patrick Cantlay (68), who had 10 birdies in the opening round when he tied the course record with a 62. He made seven birdies and an eagle in two weekend rounds.

Berger saw a leaderboard leaving the 18th green and knew he was tied. He just figured it would be with Nate Lashley, unaware of the sad turn of events on the 16th.

Lashley, playing in the final group with Spieth, nearly holed his wedge on the 11th for a tap-in birdie that took him to 16 under and leading by one shot. He was tied with Berger with three holes to play when Lashley went long on the 16th hole. He pitched out to 12 feet, missed the par putt and then missed the next two putts from the three-foot range. That gave him a triple bogey from which he could not recover. Lashley jammed the bottom of his putter into the green and left without speaking to the media.

McNealy, who played at Stanford and once lived in a house near the 15th green at Pebble Beach, quietly made five birdies over his last eight holes.

"I had the adrenaline pumping coming down the stretch there and feelings that I hadn't really felt on the golf course in a little while, trying to close this out and give myself a chance," McNealy said.

The last one was on 18 when his eagle putt stopped inches from the cup, giving him a tie for the lead that didn't last long. Berger was in the group behind him, and he played the hole to perfection.

"I wanted to win the golf tournament. I didn't want to lose it on the last," Berger said. "I just wanted to go out there and try to hit the best shot that I could, and I wasn't going to be conservative on the 3-wood coming in."

The eagle putt was fast and broke both ways, and Berger only wanted a two-putt birdie with no stress. That it fell for eagle was a bonus he was all too happy to take.

A field that featured only three players from the top 20 in the Official World Golf Ranking got one of them as a winner — Berger, who was outside the top 100 when golf returned last June as he tried to come back from wrist injuries.

"I think today really solidified my position as one of the best golfers out here, and I just need to continue to do the things I've been doing," Berger said. "And I feel like there's no limit to what I can accomplish."

Spieth finished in the top four for the second week in a row, a strong sign the three-time major winner's game is coming back after a drought that dates to his 2017 British Open victory.

"Really it was just a really poor first six holes. And out here, that's where you can score," Spieth said. "I needed to be a couple under through six, and I was 1 over. And really, that was the difference."