SAN JOSE — A gutsy play in the waning seconds cost San Jose State a chance at a season-changing victory late Friday night at Spartan Stadium. And SJSU coach Ron Caragher would go for it again.

The third-year coach said he made the right call to go for a two-point conversion attempt with 45 seconds left in the Spartans’ 17-16 defeat to Brigham Young in front of a crowd of 15,652.

“I play to win the game, not to tie or to not lose,” he said. “I felt the play we had practiced all fall camp was a good play.”

The play involved running back Tyler Ervin faking a rush to throw into the end zone to tight end Billy Freeman.

It almost worked the way the Spartans (4-5, 3-2, Mountain West) had hoped.

BYU’s Mike Wadsworth got between Freeman and the ball to help the Cougars extend their winning streak to five games.

Caragher said he decided to go for the victory as the Spartans marched downfield in the waning minutes. The coach said he didn’t want to leave the outcome to overtime with a kicking game that isn’t at an “A level.”

“I won’t doubt myself,” Caragher said. “We went for it. I won’t kick myself thinking back. I feel it was the right thing. I’d do it again.”

Quarterback Kenny Potter supported the bold play calling.

“I’m 100 percent with coach with that call,” he said. “Everybody can say what they want. It just didn’t happen.”

Potter, who completed 18 of 25 passes for 147 yards and gained 20 yards rushing, almost made it happen on the final drive.

Trailing 17-10, the Spartans pushed to the BYU 25-yard line with 1:54 left, facing a third-and-eight situation.

Potter, though, found Tim Crawley in the flat for a first down at the 16. A pass interference call put the ball on the 6-yard line.

After an incompletion, Potter raced around the left side to become the first Spartan quarterback to score a rushing touchdown in four consecutive games.

By then, Caragher already had conferred with offensive coordinator Al Borges about going for the victory.

BYU coach Bronco Mendenhall praised the play calling. He told Caragher it was the right move.

“When you play the game like that, you’ve got to go for that,” Mendenhall told reporters. “I know they’re disappointed, but it was the right thing. It was the right message to their team, it was the right message to their program. And they almost pulled it off.”

Instead, San Jose State continued its November swoon in the latest finish in Spartan Stadium history. The game ended just before midnight.

The Spartans extended their November losing streak to six games, and have won only twice in the past 11 games in the dreaded month.

San Jose State now faces the unenviable challenge of winning two of its final three games to become bowl eligible. It won’t be easy with road games at Nevada and Hawaii the next two weeks, followed by the regular-season finale at home against Boise State (7-2, 4-1).

But Caragher is encouraged by his team’s improvement. After giving up touchdowns on BYU’s first two possessions, the defense buckled down and frustrated the Cougars (7-2).

Brigham Young scored only three points in the second half.

“All we know is to compete,” said Cleveland Wallace III, who had a “pick-six” interception return at the end of the first half. “That’s in our nature.”

Wallace III’s 61-yard touchdown return got San Jose State to within four points, 14-10, at halftime.

Then the defense gave the Spartans a chance to win in the second half.

They sacked BYU freshman quarterback Tanner Mangum three times to perhaps jar his confidence after a strong start.

Mangum completed 23 of 37 passes for 293 yards, but struggled to convert third-down plays after halftime.

BYU’s 17 points and 329 yards of total offense were its second fewest this year.

“My message to the players was, they fought valiantly,” Caragher said.

San Jose State will have to play just as hard in the final three games of the season to reach the six-victory threshold for bowl eligibility.

Contact Elliott Almond at 408-920-5865. Follow him on Twitter at twitter.com/elliottalmond.