AUBURN, Ala. -- Peyton Barber made sure Auburn's offense got into the end zone this time - repeatedly.
Barber rushed for five touchdowns, including a decisive 36-yarder, and Auburn beat San Jose State 35-21 Saturday to snap a two-game losing streak.
The Tigers (3-2) forced four turnovers to help overcome Tyler Ervin's 160 rushing yards and continued struggles on both sides of the ball.
The Spartans (2-3), who lost last year's meeting 59-13, wouldn't go away. Ervin darted for a 2-yard touchdown after Auburn missed a short field goal to pull to within one score with 5:38 left in the fourth quarter.
The onside kick failed and Barber scampered for touchdown No. 5 after four short ones. The Tigers' workhorse ran for most of his 147 yards in the second half and came up one TD shy of Carnell Williams' school single-game record for rushing touchdowns set against Mississippi State in 2003.
Barber, who has been Auburn's steadiest offensive playmaker, came in with a long run of 21 yards. He got his fourth 100-yard effort in five games and pushed an offense that didn't produce a touchdown against Mississippi State toward and across the goal line.
The nation's leader in all-purpose yards, Ervin followed up a 300-yard rushing game with 27 carries and another big effort.
It's the second time Auburn has struggled to put away a sizable underdog at home, including an overtime win over FCS Jacksonville State. San Jose State had a 406-342 advantage in total offense.
This time the Tigers put it in Barber's hands. He ran 17 times for 109 yards in the second half while Sean White only put the ball in the air twice. White was 6-of-10 passing for 108 yards in his second start against a defense that came in second nationally in passing yards allowed.
Former starter Jeremy Johnson didn't get into the game for a second straight week.
San Jose State didn't punt until late in the third quarter after converting one of three fourth-down attempts.
Some in the shrunken Auburn crowd booed coach Gus Malzahn's decision to kick a field goal on fourth-and-1 in the final quarter despite the fact that it could make it a three-score game. Then, Daniel Carlson missed a 25-yard attempt.
The Spartans deepened the angst with an 80-yard touchdown drive aided by a pass interference call against Blake Countess in the end zone. The 177-pound Ervin darted for a 2-yard touchdown with 5:38 left to pull to within 28-21.
Auburn receiver D'haquille Williams recovered the onside kick, the last of several gambles for the Spartans coach Ron Caragher. A last drive ended with Joe Gray throwing his second interception in a 224-yard passing day.
By that time, thousands of Auburn fans had already hit the exits. The Tigers had opened the season ranked No. 6.