Martinez scored on a 38-yard run, threw a 10-yard TD pass to Kyler Reed and set up Brett Maher for the tying and go-ahead field goals. Maher's 41-yarder with 9:41 left gave the Huskers (4-1, 1-0) their first lead in the Big Ten opener.
Danny O'Brien, who replaced Joel Stave, tried to bring back the two-time defending Big Ten champion Badgers (3-2, 0-1) with less than three minutes to play. But Montee Ball fumbled at midfield on a fourth-and-1, and Martinez took a knee three times to run out the last minute.
The comeback tied the second-largest comeback in program history, trailing only Nebraska's rally from a 21-point deficit in the third quarter last season against Ohio State.
Martinez ran for 107 yards and threw for 181 yards and two touchdowns. Stave passed for 214 yards and a touchdown.
"I thought Taylor did some really good things," Nebraska coach Bo Pelini said. "He started slow and got better as the game went on. He settled in and played a pretty good football game."
The Huskers continue their difficult conference schedule at unbeaten Ohio State before opening Legends Division play at unbeaten Northwestern on Oct. 20.
"It's going to be the team that gets better week to week," Pelini said, "and that's the challenge in front of us. We have a heck of a challenge in front of us next week."
Rex Burkhead ran for 86 yards for the Huskers.
Ball, coming back from a head injury last week, carried 32 times for 90 yards and three touchdowns.
Both teams wore eye-catching alternate uniforms, and the Huskers and their fans were juiced up for the game after Nebraska was beaten 48-17 in Madison last year.
Playing off the energy of the boisterous Memorial Stadium crowd, the Nebraska defense held the Badgers to 90 yards in the second half.
Martinez kept the Badgers' defense on the field way too long in the second half, and it showed as the Huskers picked up yards in big chunks.
"I think that's the way we should normally play," Martinez said. "We struggled (early) because we couldn't get a rhythm going. We put our defense in a tough situation. Luckily, they kept making stops, and we kept scoring points."
The Badgers had threatened to break open the game after defensive end David Gilbert blew past Nebraska left tackle Brent Qvale on his way to sacking Martinez and knocking the ball loose on the Huskers' fourth play of the second half.
Chris Borland picked up the ball for his second fumble recovery of the night, and four plays later Ball ran in from the 2.
The Huskers then started the comeback.
Martinez scored from 38 yards, slipping through the line on a quarterback draw and outrunning Dezmen Southward to the left pylon.
The Huskers got a three-and-out after Ball, needing a yard for a first down, bounced backward off his offensive lineman and Sean Fisher wrestled him down.
Martinez then led the Huskers 75 yards in 10 plays to make it a three-point game after he hit tight end Reed with a 10-yard pass across the middle of the end zone.
With the crowd raising the decibel level with chants of "Go Big Red, Go Big Red," the Huskers forced another three-and-out.
Martinez moved the Huskers from the 37 to the Wisconsin 21, and Brett Maher's 38-yard field goal made it a tie game heading to the fourth quarter.
After yet another Wisconsin punt, the Huskers went from their 16 to the Wisconsin 24, and Maher hit a 41-yarder for the lead.
The question coming into the game was whether Stave would be poised in making his first road start in such a big game.
It turned out that the home team was the unsteady one early. Stave was just fine — actually, better than fine in the first half.
The redshirt freshman threw a beautiful 54-yard pass to Jared Abbrederis on the game's second play, and three plays later Ball scored from the 2.
Wisconsin got the ball right back. Burkhead fumbled while running up the back of offensive lineman Spencer Long. The Badgers went 23 yards for a quick 14-0 lead, with Ball bulling his way into the end zone from the 1.
After a Nebraska field goal, Abbrederis leapt in front of cornerback Andrew Green to catch a 29-yard touchdown pass. It was a 17-point game after Jack Russell missed the extra point.
Martinez led a 12-play drive that cut Wisconsin's lead to 20-10, finishing it with a 3-yard play-action pass to Burkhead.
More Sports Headlines
Snohomish mixed martial artist returns to her first love Mariners beat Twins 4-3 in 11 innings Charles scores 29 points, Liberty beat Storm 78-62 4:49 p.m. Park wins Women's British Open, captures 4th different major 4:38 p.m. Perry wins 2nd straight Champions Tour's 3M Championship 4:33 p.m. Merritt shoots 67 to win Quicken Loans National by 3 shots 4:30 p.m. Triple Crown winner American Pharoah wins $1.75 million Haskell Invitational 4:25 p.m. Bills' Ryan names Incognito starting left guard 4:22 p.m.
Our new comment system is not supported in IE 7. Please upgrade your browser here.