FOXBOROUGH, Mass. (AP) -- The New England Patriots played one of their worst games on defense this season.
However when it mattered most, safety Devin McCourty made the play that won the game.
After giving up 35 first downs and 481 yards, New England stopped the Buffalo Bills when McCourty intercepted a pass thrown right at him in the end zone with 23 seconds left.
That interception clinched a 37-31 win on Sunday that was tougher than expected against a team that lost for the fifth time in six games.
"No matter what happens in the game, there's nothing bigger than turnovers," McCourty said. "A lot of times if you can just win that turnover ratio, you end up winning the game."
The Patriots began the day with an AFC-best plus-13 turnover differential. They increased that to plus-16 with the interception and two fumble recoveries, one in the fourth quarter that the Patriots recovered at their 1-yard line.
Not bad for a team with only the 22nd-ranked defense going into the game.
"Every time we've played these guys, we've been successful moving the ball," Bills running back C.J. Spiller said, "The guys on the sideline were very confident we could go down and win it, but they just made that play at the end."
Ryan Fitzpatrick even outplayed Tom Brady -- until that last, errant throw.
Fitzpatrick completed 27 of 40 passes for 337 yards, while Brady was 23 for 38 for 237. Each threw two touchdown passes.
"It's frustrating when we don't play as well as we're capable of," Brady said. "Part of the mental toughness of the game is to put those things behind you and to keep playing hard. We did that and that's why we won."
The Patriots (6-3) lead the AFC East but let a 17-3 lead slip to 34-31 with 7:47 left on Fitzpatrick's 2-yard scoring pass to Donald Jones. Then the Bills (3-6) held the Patriots to a 27-yard field goal by Stephen Gostkowski with 2:06 to go.
A touchdown and the extra point would give Buffalo a victory.
But on second-and-10 from the New England 15, Fitzpatrick threw toward T.J. Graham and McCourty caught it in front of him and immediately went down for a touchback.
"The only thing you can ask for as a quarterback is a chance at the end to win the game and we had that," Fitzpatrick said, "but we weren't able to get it done."
New England is 11-0 against the Bills at Gillette since it opened in 2002 and 23-2 overall in its past 25 games against Buffalo.
The Patriots extended their streak to 11 straight scoring possessions against the Bills with a field goal and three touchdowns on their first four series Sunday. In the previous meeting, a 52-28 win, New England scored on its last seven series: six touchdowns followed by a field goal.
But not even that could give the Patriots a secure lead and they entered the fourth quarter ahead 31-24.
"They didn't really hit us with a lot of big plays," Patriots coach Bill Belichick said. "They've got an explosive group of skilled players and they got them all involved."
The Patriots led 24-17 at halftime, scoring on a 43-yard field goal by Gostkowski, touchdown runs of 1 yard by Stevan Ridley and 15 yards by Danny Woodhead, and a 2-yard pass from Brady to Rob Gronkowski.
The Bills scored on a 42-yard field goal by Rian Lindell, a 14-yard run by Fred Jackson and a 3-yard pass from Fitzpatrick to Scott Chandler with 31 seconds left in the half. Woodhead scored again on an 18-yard pass from Brady. But the Bills cut the lead to 31-24 on the next possession on a 1-yard run by Jackson.
Gostkowski's 48-yard field goal gave the Patriots a 34-24 lead 50 seconds into the fourth quarter.
The Patriots were coming off a bye that followed their best game of the season, a 45-7 win over the St. Louis Rams in London. The Bills need a sharp turnaround to avoid their 13th straight non-playoff season.
"Still a chance," coach Chan Gailey said. "I think we'll get there. I know I'm in the minority, but thank goodness I've got a group of guys in that room in there that, I think, think the same thing."
The Patriots have an excellent chance for a postseason berth in the mediocre division.
"If we can keep improving all the way down to the end of the season and string good games together," McCourty said, "we'll be in good shape."
NOTES: Running back Kevin Faulk, who recently announced his retirement after not playing this season, was honored by the Patriots at a halftime ceremony. ... The Patriots allowed a season-worst 162 yards rushing, led by Jackson with 80 and Spiller with 70. ... Buffalo was called for 14 penalties, its most since Oct. 1, 2006, when it had 15 against the Minnesota Vikings. The Bills' 148 penalty yards were second most in team history since they had 159 in 1970 against the Boston Patriots.
Online: http://pro32.ap.org/poll and http://twitter.com/AP_NFL