SEATTLE — Tom Brady and the best offense in the NFL got upstaged by an undersized rookie.

In the final minutes, it was Russell Wilson and the Seattle Seahawks making all the big plays.

Wilson found Sidney Rice behind the secondary for a 46-yard touchdown with 1:18 remaining, and the Seahawks rallied for 14 points in the final 7:31 to stun the New England Patriots 24-23 Sunday.

The matchup between the Patriots’ No. 1 ranked offense and Seattle’s No. 1 defense instead turned in to a starring performance for Wilson, and a shocking rally.

Wilson hit Braylon Edwards on fourth down for a 10-yard TD to get the Seahawks within 23-17. After a pair of holds by Seattle’s defense, Wilson found Rice streaking open on a double move for his third touchdown pass of the game. Steven Hauschka’s extra point gave Seattle (4-2) the lead with 78 seconds remaining.

Brady had a final chance to make up for all the opportunities the Patriots (3-3) squandered. Starting at his 20 with 1:14 left, Brady missed Brandon Lloyd, then was sacked by Jason Jones, the first sack all day by Seattle. His pass for Aaron Hernandez, back after being out since Week 2 with an ankle injury, was incomplete, and Wes Welker was stopped short on fourth down.

That gave former Patriots coach Pete Carroll one of his biggest pro victories.

Wilson finished 16 of 27 for 293 yards, the best day of his young career. He added Brady to an impressive list of quarterbacks he’s topped this year: Tony Romo, Aaron Rodgers and Cam Newton.

Brady finished 36 of 58 for 395 yards and touchdown passes of 1 yard to Hernandez and 46 yards to Welker in the first half. Welker had 10 catches for 138 yards, his fourth straight game over 100. Brady topped 300 yards passing for the 49th time, but was intercepted in the second half by Richard Sherman and Earl Thomas after going 179 attempts without being picked off. One of Brady’s interceptions came in the end zone, yet another squandered chance by the Patriots.

Seattle gained 158 yards in the first quarter then just 70 in the second and third quarters combined. But Wilson had a big rally left.

Stephen Gostkowski’s third field goal, a 35-yarder, with 9:21 remaining gave the Patriots’ a 23-10 lead, the third time New England settled for field goals. There was also a Patriots drive at the end of the first half when coach Bill Belichick opted to throw with 6 seconds remaining instead of kicking the field goal from the Seattle 3. Brady was flagged for intentional grounding and the ensuing time runoff ended the half.

Following Gostkowski’s third kick, Seattle surpassed its entire second half offensive output when Wilson hit Tate for 51 yards and a roughing penalty on Brandon Spikes moved the ball to the Patriots 17. Facing fourth-and-3 at the 10, Wilson found Edwards, who entered the day with one catch since Week 1, in the end zone.

It was Edwards’ first touchdown since the 2010 season with the Jets.

Seattle forced New England into its fifth three-and-out of the season and Leon Washington’s 25-yard punt return gave the Seahawks possession at their 43 with 2:38 left. Marshawn Lynch, held to 41 yards on 15 carries, converted a third-and-1 and then Wilson hit Rice to give Seattle the huge win.