SAN JOSE, Calif. (AP) _ Pat Barnes threw four touchdown passes, and California overcame a slew of penalties Saturday to beat San Jose State 45-25 and give first-year coach Steve Mariucci a victory in his debut.

Barnes completed 19 of 23 passes for 248 yards, and Tarik Smith ran for 186 yards on 36 carries in Cal's season-opening triumph. It was the Bears' ninth straight victory over the Spartans (0-2).

The Bears outscored San Jose State 21-11 in the third quarter, but struggled to shake loose while being hit with a team-record 21 penalties for 202 yards in losses.

Cal regrouped to score 10 points in the fourth period and pull away from the Spartans, who were hurt by three turnovers, all in the second half.

Cal's opening second-half drive ended in Barnes' 5-yard scoring pass to Bobby Shaw, but the Spartans answered with Joe Furlow's 33-yard field goal.

Matt Beck recovered a fumbled punt by San Jose's Damon Bowers at the 9, and two plays later, Smith went into the end zone from 1 yard, putting the Bears up 28-17.

After a third-down personal foul call against Cal gave the Spartans a first down, Windrell Hayes turned a short reception from Carl Dean into a 59-yard advance to Cal's 2. Two plays later, Patrick Walsh scored on a 1-yard run and Dean passed to Hayes for the 2-point conversion to pull the Spartans to 28-25.

But San Jose would get no closer.

Barnes connected with Bobby Shaw on a 44-yard pass play and a face mask penalty added 15 more yards, leading to Barnes' 7-yard scoring pass to Marc Vera with 21 seconds left in the third quarter.

Ryan Longwell added a 32-yard field goal and Barnes hit Shaw with a 2-yard scoring pass in the fourth quarter after Don Lonon gave Cal possession with a 34-yard return on his interception of Dean.

San Jose State responded with a drive deep into Cal territory, which ended when Billy Vuniwai's fumble was recovered by Kato Serwanga.

Cal broke on top when Ziv Gottlieb converted a botched field-goal try into a 23-yard yard touchdown pass to Sean Bullard, but the Spartans came back with a pair of second-quarter scores to pull into a 14-all tie at halftime.

Carlos Meeks swept around right end for a 5-yard score, capping an 18-play, 85-yard march kept alive by two offsides penalties against Cal, including one during a punt.

Another penalty helped set up Walsh's 1-yard touchdown run with 45 seconds remaining in the second quarter. Cal's Kevin Devine was flagged for pass interference on David Doyle, a 15-yard penalty that gave the Spartans a first down at the 20. Three straight runs advanced the ball to the 1, and Walsh bulled his way into the end zone for the score.

Gottlieb, a backup quarterback and the holder on placements, handled a high snap, but couldn't get the ball down in time for Ryan Longwell's kick. He scrambled to his feet, rolled right to evade pressure and hit the wide-open Bullard for his first career scoring pass.

Barnes' 27-yard touchdown pass to Brandon Willis gave Cal a 14-7 lead.