SOUTH BEND, Ind. (AP) — Same end zone, same result.

Two years ago, Stanford lost to the Fighting Irish in overtime after a controversial play where the Cardinal thought they were robbed of a touchdown on a goal-line stand. On Saturday, No. 14 Stanford was in that end zone again — and this time, left Notre Dame tight end Ben Koyack uncovered.

Koyack scored the game-winner with just 61 seconds left, giving the No. 9 Irish a 17-14 win.

The Cardinal appeared to be in control when Remound Wright scored on an 11-yard run with 3:01 left to put Stanford ahead 14-10. But the Cardinal defense, which entered the game as best in the nation in total defense and scoring defense, couldn't hang on.

Stanford coach David Shaw said the Irish were tougher.

"They fought longer and harder than we did," he said.

The Cardinal had given up only five plays of 21 yards or longer in their opening four games, but gave up four against the Irish.

"We can't have that," linebacker Kevin Anderson said. "We've got to eliminate explosives. That's one of our main goals and we've done a good job so far. That changed the game."

Stanford entered the game giving up 198 yards a game total offense and had given up only two runs of 25 yards or more. The Irish had 192 yards total offense at halftime and Everett Golson had a career-long 33-yard run to set up a touchdown and C.J. Prosise had a 26-yard run that set up a scoring chance. Amir Carlisle added a 26-yard catch. But the biggest play was the 23-yard pass from Golson to Koyakc on the game-winner.

Koyack caught the pass as he fell out of bounds, while safety Jordan Richards dove to try to break it up, and scored the winning touchdown with 61 seconds left to give the Irish the 17-14 victory on a cold, rainy Saturday.

"I went to my first read and it wasn't there and I needed to begin improvising a little bit," Golson said. "I guess they busted the coverage a little bit and I found Koyack in the back of the end zone."

Koyack said he broke off his route when he saw the coverage and hoped Golson would see him.

"He did," he said. "It felt like the ball was in the air for about an hour."

"There was no coverage on Notre Dame's touchdown pass," Stanford coach David Shaw said. "That sounds sarcastic but he was wide open. There was nobody on him."

Richards said Koyack got behind the Cardinal defense.

"I was just trying to head over there as fast as I could but I just couldn't do it," he said.

Golson struggled with accuracy at times and threw an interception and had a fumble that was hard to overcome, but still managed to pull it out.

The Fighting Irish improved to 5-0 for just the third time since Lou Holtz left in 1996 and the second time in three seasons. The Cardinal (3-2) have two losses this early in the season for the first time since opening 1-2 in 2008 in Jim Harbaugh's second season as coach.

Golson also threw a 17-yard TD pass to Chris Brown and Notre Dame amassed 370 yards of total offense against the nation's top defense. The Irish defense held the Cardinal to 139 yards total offense and just 47 yards rushing — the fewest rushing yards by Stanford in seven years. Stanford receiver Ty Montgomery, who entered the game averaging 69 yards a game receiving, was held to four catches for 12 yards. But he did have a 42-yard kickoff return that helped set up a Stanford touchdown late in the fourth quarter.

Shaw was disappointed the Cardinal defense couldn't hold on.

"We had a chance to seal it and we didn't," he said.

Golson was 20-of-43 passing for 241 yards with one interception and a fumble a week after having four turnovers against Syracuse. Kevin Hogan was 18 of 36 for 158 yards with two interceptions for Stanford.

Wright said Notre Dame didn't do anything special to stop Stanford.

"We just stopped ourselves. That's kind of been the theme on the year for us," he said.