SAN MARTIN, Calif. — Just when it seemed as if the U.S. Women's Open would come down to the final hole of the three-hole playoff, a rules violation changed everything and helped deliver Brittany Lang her first major title.

Lang was the beneficiary of a delayed two-stroke penalty called on Anna Nordqvist on Sunday, as she won the title she was so close to seizing when she was runner-up 11 years ago as an amateur.

“You never want to win with a penalty or something like that happen, especially to Anna, who is a friend of mine and a great player and a classy girl,” Lang said. “But it's unfortunate. It's part of the game and it happened that way.”

Lang made par on all three holes of the aggregate playoff and Nordqvist was given a two-stroke penalty for touching the sand with her club in a fairway bunker on the second playoff hole, helping deliver Lang the title.

The players were not told of the penalty until they were in the middle of playing the final hole, after officials reviewed replays in the latest controversy at a USGA event after the delayed penalty called in the final round on eventual men's U.S. Open winner Dustin Johnson last month.

“Seemed kind of unreal that it happened, but it does,” Nordqvist said. “It wasn't any reason to question it. But I'm certainly disappointed of the timing of it.”

Lang then sealed the win with a short par putt on the final playoff hole, while Nordqvist made bogey to lose by three shots.

Lang shot a 1-under 71 to finish with a 6-under 282 for the tournament at CordeValle for her second win in 287 tournaments on the LPGA Tour. She survived a bogey on the 17th hole that led to the playoff before recovering in the playoff for a breakthrough win at age 30.

“I think this is absolutely huge, a huge momentum builder to say you won the U.S. Open,” Lang said. “I think this is a huge, a huge step in the right direction for my career.”

Both players made pars on the first hole of the playoff, which was played on the final three holes of the course. Then things got interesting on the next hole after Nordqvist hit her tee shot into a fairway bunker.

While she was preparing to hit the shot, Nordqvist's club barely touched the sand. She did not realize it and both players made par on the hole, heading to the final playoff hole seemingly tied.

But after seeing a replay, broadcaster Fox asked the USGA if there had been a violation. That led USGA official John Bodenhamer to go to the television truck to see a replay, which showed the violation that was not evident on the live broadcast or to the official watching the hole in person.

Bodenhamer then said he decided to immediately tell the players but the news got to Nordqvist after she hit her third shot at 18 and before Lang did. Nordqvist said she would have been more aggressive going for the pin if she had known she needed birdie. Lang changed clubs for a safer approach shot, knowing a par would win the tournament.

“It certainly changed her game plan,” Nordqvist said. “But, you know, hopefully we can all learn from it and hopefully we can all get better.”

Lang hit her shot onto the green and the two-putted for the win, getting hearty congratulations from many of her fellow Americans on tour after she joined Michelle Wie (2014) as the only U.S. golfers to win the Open in the past six years.

Lang came onto the scene as an amateur back in 2005 when she finished tied for second at the U.S. Women's Open at Cherry Hills. But in more than a decade as a pro, Lang had won just one tournament, the 2012 Manulife Financial LPGA.

Lang capitalized on a surprising final-round collapse by world No. 1 Lydia Ko, who led after 54 holes but made a double-bogey 7 on the ninth hole and shot 3-over 75 on the day, finishing two shots off the lead in a four-way tie for third with Amy Yang, Sung Hyun Park and 2009 winner Eun Hee Ji.