STANFORD, Calif. – Zach Ryan scored his first career overtime winner early in the second extra session and No. 9 Stanford wrapped up the nonconference portion of its schedule with a 1-0 victory over No. 11 Denver at Cagan Stadium on Friday night.

The shutout upped the Cardinal's record to 23-2-5 in its last 30 matches against ranked opponents. Ryan's goal was his seventh of the season to move him into sole possession of seventh place among freshmen in Stanford (9-2-4) history (records since 1979).

"Denver changed and dropped into a back five, which meant we got more of the ball, but we weren't having any space in front of goal," Knowles Family Director of Men's Soccer Jeremy Gunn said. "We were desperately trying to thrust out wide and needed the strikers just to be patient. We just kept telling the strikers to let the back four and let the midfielders do the work on the ball and just make sure to be alive and be a fox in the box. In that moment Zach was in the perfect spot."

The sequence started in the 101st when Ryan Ludwick tracked down the ball outside the right corner of the box and dumped it down to Charlie Wehan. Wehan settled it and squared up his defender before racing toward the endline. The sophomore winger took two touches before sending in his cross under the leg of his marker to Ryan who had made a run to the top of the six. Ryan displayed some first-touch magic, swept his right-legged shot bar down and in to send the crowd into a frenzy.

The game-winning goal wasn't the redshirt freshman's only chance of the evening. In the 28th minute, heat was taken off his header in the box when it ricocheted off a Pioneer (12-3-2) player and into the arms of goalkeeper Will Palmquist. Twenty minutes later Palmquist was forced to make an acrobatic save and tip Ryan's header up and over the crossbar on another Wehan cross. And midway through the first overtime period Ryan had a left-footed attempt in the box blocked by Denver's back line and sent out of harm's way.

"I thought we were fantastic," Gunn added. "We had an incredible amount of possession and moved the ball really, really well. Denver kept it really tight at the back and they're always in the game because they have some electrifying attacking players, but we were always the aggressor. If we'd scored a goal it would have changed things completely and given us more space to attack, but while it was 0-0 it was always anybody's game no matter how many more chances we had."

Stanford's defense, which pitched its first shutout in the month of October, was also able to shutdown Denver's Andre Shinyashiki, who leads the nation with 24 goals this season. Shinyashiki had a couple of strikes from distance, but nothing out of the ordinary for the Cardinal or its keeper Andrew Thomas.

49' Palmquist with a big save to push it over the bar and out for a corner.

[9] Stanford 0-0 [11] Denver. #PioneerTogether #STANvDEN pic.twitter.com/EZ5caeyOzC — Denver MSoccer (@DU_MSoccer) October 27, 2018

"We passed the ball so well and had so much possession that we didn't have to defend as much," Gunn said. "[Shinyashiki] put in a shift tonight working defensively. They only need a little bit of space, but I thought our back four were fantastic and our midfield really worked hard to collapse on those good players. I just don't think they were ever allowed to be happy or excited."

Stanford, currently tied for first in the Pac-12 on 16 points with Oregon State, heads back into conference action next Thursday night at San Diego State (7 p.m.).

MORE: 5 of the most prolific men's soccer scorers | Selection committee to announce top 10 Sunday