Colorado State never let the Gophers get comfortable Saturday.

The Rams entered TCF Bank Stadium as 17-point underdogs and used a fourth-quarter fake punt to make it a one-possession game.

But on a day when their defense was maddeningly inconsistent, the Gophers did enough offensively again to avoid an upset.

Shannon Brooks returned from his foot injury to rush for 85 yards, Rodney Smith added 99 yards and two touchdowns, and the Gophers held off the Rams 31-24 before an announced crowd of 44,854.

"We're getting better each week," Smith said. "We're building confidence as a group, and I'm just confident heading into Big Ten play."

The Gophers (3-0) will need that offensive swagger next week, when they will play before an expected 106,000 fans at Penn State.

Defensively, they have given up 25 points per game, up from 18.5 in nonconference play last season. But they have yet to lay an egg on offense, as they did early last season, when it was like Easter every Saturday in September.

Last year, they scored 17 points against TCU, 23 at Colorado State, 10 against Kent State, and 27 against Ohio before getting blanked in the Big Ten opener at Northwestern.

Coach Tracy Claeys hired offensive coordinator Jay Johnson to change all that, and so far, so good. The Gophers are averaging 39.7 points per game, albeit against Oregon State, Indiana State and Colorado State (2-2), which opened its season with a 44-7 loss to Colorado.

Claeys appreciates that when opponents have scored, "we seem to find a way to answer."

That trend held Saturday. The Gophers followed Colorado State's first three scores with touchdown drives of their own.

Leidner completed 16 of 20 passes for 174 yards, with one interception. He rushed 10 times for 50 yards and a touchdown, looking very nimble after offseason foot surgery.

"I've never been this healthy coming out of the nonconference, so it feels really good," the fifth-year senior said.

On one second-quarter run, Leidner made moves that left two defenders grasping at air.

"I went over there after the play and asked him if those were his 'Like Mike' cleats because I don't know where he got that from," Brooks said. "It's fun joking around with him when he makes plays like that."

Brooks, who broke a bone in his right foot last month, came back and made a few plays himself. He steamrolled cornerback Tyree Simmons on a 35-yard run in the third quarter, then waltzed in for a 9-yard touchdown. He showed why he led the Gophers in rushing as a freshman last season.

Smith remained potent, too. He has racked up 298 rushing yards and five touchdowns in three games.

"They played extremely well," Colorado State coach Mike Bobo said. "They protected the ball. They did a great job on third down, and even the few times we were able to gain some momentum, they were able to answer every time."

It was 31-17 when Colorado State lined up to punt from its own 30-yard line. All-America punter Hayden Hunt took the snap and hit Braylin Scott with a pass that gained 29 yards for a first down. Scott had lined up on the left side of the formation, and the Gophers lost him as he roamed through the scrum for the pass.

"We should have had somebody in the middle of the field for that," Claeys said.

Freshman quarterback Collin Hill later hit Michael Gallup for a 15-yard touchdown pass. The Rams, who lost to Minnesota 23-20 in overtime last year in Fort Collins, weren't going anywhere.

The 6-5 Hill had popped right up in the first half, despite losing his helmet and fumbling on a huge hit by Gophers freshman Tai'yon Devers. Hill finished 15-for-30 for 182 yards.

Trailing by seven, Colorado State forced the Gophers to go three-and-out on their next possession, handing Leidner his first sack of the season.

But the Gophers defense came up with a big stop, as the Rams turned the ball over on downs at the 45-yard line with 1 minute, 50 seconds remaining.

The Gophers got two first-down runs from Brooks to kill the clock.

"I told the kids, 'This game is a great game. It rewards kids and teams that don't quit,' " Claeys said. "I think we played hard. We didn't quit. We didn't play well all the time, but we finished it off. Like I say, 'We'll never complain about winning.' "