Washington State defeats Iowa State 28-26 in the Valero Alamo Bowl for the Pac-12's first bowl win in a year. (3:08)

Gardner Minshew II and that glorious mustache conjured up a final bit of magic in a grand finale for Washington State.

Minshew, a graduate transfer quarterback whose whiskered upper lip was loved and mimicked by Cougars fans all season, threw two touchdown passes and ran for another score in sending No. 13 Washington State (No. 12 AP) to a 28-26 win over No. 24 Iowa State (No. 25 AP) in the Valero Alamo Bowl on Friday night.

Minshew's passing and scrambling earned the Cougars (11-2) a school record for wins in a season. He also finished with 4,779 passing yards this season, breaking the Pac-12 single-season record previously held by California's Jared Goff (4,719).

Minshew passed for 299 yards Friday, none of them bigger than a play made out of desperation when Iowa State had all the momentum.

After watching a 21-10 lead dwindle to 21-20 by early in the fourth quarter, the Cougars stripped the ball from Iowa State running back David Montgomery at the Cyclones' 30. Minshew, who had been held in check in the third quarter, escaped a third-down pass rush to flip a last-second shovel pass to Tay Martin that went for 20 yards.

The play stunned the Cyclones, and Max Borghi scored on a 10-yard run the next play.

It was just another big fourth-quarter moment for the transfer from East Carolina whom coach Mike Leach had lured out West with the promise he could lead the nation in passing.

Minshew was the nation's leading passer in yards per game this season and won the Johnny Unitas Award as the nation's top senior quarterback in a season the Cougars fell one game short of playing for the Pac-12 championship.

Nearly all of his completions this season were more orthodox than the flip to Martin. None were bigger than this one for the season and the legacy it left for the program.

"I want to say thank you to these coaches, this university and these fans for taking me in," Minshew said.

"So glad to be a part of this," he added. "One thing I've always been told is to leave a place better than we found it. This place could be really special."

The Cyclones did a good job in bottling Minshew up for much of the game. Iowa State's defense held Washington State to 10 points and 135 yards below its season averages, and two of the Cougars' touchdowns came on short drives after turnovers.

But after Minshew found a way to get Washington State in the end zone, the Cougars' defense made the one play it had to at the end.

Iowa State's last chance came after quarterback Brock Purdy scored from a yard out with 4:02 left. The Cyclones went for two, but a pass to Montgomery was stopped well short of the goal line after a false-start penalty pushed the line of scrimmage back to the 8.

Iowa State had seven false-start penalties and had two players ejected for targeting hits on Minshew.

Purdy passed for 315 yards, and Cyclones wide receiver Hakeem Butler caught nine passes for 192 yards, 6 yards shy of the Alamo Bowl record. Montgomery rushed for 124 yards.

The Cyclones (8-5) had rallied from a 1-3 start to finish third in the Big 12, the program's best conference finish in 40 years.

"This team never quits, plays with elite attitude and elite effort. The missing piece for us right now is in the detail," Iowa State coach Matt Campbell said. "Now, to take the next step in this program is detail. It's what got us tonight. Silly mistakes."

THE TAKEAWAY

Washington State: Minshew survived several tough hits in the first half and was excellent when it was time to kill the clock. He completed 9 of 13 passes in the fourth quarter for 78 yards. After Iowa State's final touchdown, he completed three passes, two of them converting third downs, as the Cougars ran out the clock.

Iowa State: Turnovers and targeting calls were critical. Purdy threw two first-quarter interceptions, and Montgomery's fumble was a game-changer. Iowa State had two key defenders ejected in the second quarter for targeting hits to Minshew. Senior linebacker Willie Harvey was ejected after smashing Minshew in the face mask on a scramble. Defensive end Eyioma Uwazurike was booted after a sack knocked Minshew's helmet off.

TOUCHDOWN TAUNTING

Washington State cornerback Marcus Strong had a long touchdown interception return wiped out in the first quarter when he was flagged for taunting on his way into the end zone. Strong stepped in front of a pass intended for Butler and had a clear path to the goal line. He was penalized because he held the ball out and looked back as Purdy made a futile dive for his feet. Instead of the score, the Cougars got the ball on the Iowa State 20 and scored two plays later when Minshew connected with Renard Bell.

UP NEXT

Washington State: Leach has to find another big-armed quarterback to be among the nation's passing leaders in 2019. If he does that, the Cougars should be among the Pac-12 favorites as they return 14 starters on offense and defense, plus their kicking specialists.

Iowa State: The Cyclones were in the mix for a Big 12 title game berth late in the season and will expect to be in contention again in 2019, with Purdy leading an experienced lineup that loses only five senior starters. The key will be the NFL draft options for 1,000-yard rusher Montgomery and 1,000-yard receiver Butler.

The Associated Press contributed to this report.