FOXBOROUGH, Mass. (AP) -- Tom Brady was having his worst game of the season. Then he did what he does best.
Trailing by three points with 2:31 left, the NFL's reigning MVP marched the New England Patriots down the field for an 8-yard touchdown pass to Aaron Hernandez with 22 seconds remaining that capped a 20-16 win over the Dallas Cowboys on Sunday.
"You're a long way away from the goal line and you haven't really moved the ball that well," Patriots coach Bill Belichick said. "I've said it before, there's no quarterback I'd rather have."
The Patriots trailed 16-13 when they got the ball at their 20-yard line after a punt. At that point, Brady had completed just 19 of 32 passes for 211 yards with one touchdown, two interceptions and three sacks. Starting with a 16-yard completion to Hernandez, Brady went 8 for 9 for 78 yards. The other 2 yards came on Brady's 2-yard sneak for a first down.
"When you have a quarterback like Tom, anything can happen as long as there's time on the clock," Hernandez said.
It was the 32nd successful comeback of Brady's career in games the Patriots trailed or were tied in the fourth quarter. And it came against a solid defense - ranked fourth in the NFL - that had allowed just one touchdown on the Patriots' first nine possessions.
"When you're playing against a quarterback like Tom Brady , he's going to go down as one of the all-time greats," Cowboys coach Jason Garrett said. "So you have to try to make it hard on him."
The Patriots improved to 5-1, the best record in the AFC. The Cowboys fell to 2-3, but two of those losses were by four points and the other by three.
"This isn't a 2-3 team," said Dallas cornerback Terence Newman , who had an interception and a fumble recovery. "We've got some good pieces here."
The Cowboys were coming off a bye. Next up are the St. Louis Rams.
The Patriots are heading into a bye and return for a road game against the Pittsburgh Steelers .
"We're still building," Brady said. "We're nowhere near where we need to be and nowhere near where we're going to be in a couple of months."
Dallas quarterback Tony Romo was 27 of 41 for 317 yards with one touchdown and one interception in his first game since a 34-30 loss to Detroit in which the Cowboys squandered a 24-point, third-quarter lead and Romo threw two interceptions that were returned for TDs.
"This team is continuing to grow and get better," Romo said. "We just need to finish a game like today and we will, I think."
The Cowboys, who trailed 13-3 midway through the second quarter, took a 16-13 lead with 5:13 left on Dan Bailey 's third field goal of the game, a 26-yarder.
The Patriots then punted, but the Cowboys were content to use up the clock by running the ball - three rushes for 5 yards, plus a 5-yard penalty - and punted right back.
"You have to run the ball in that situation because of the time situation," said Garrett, who trusted his defense to stop the Patriots. "It's one of the best offenses in the league. You're challenging your defense, no doubt about it."
Until the final drive, Cowboys defensive coordinator Rob Ryan was headed for his second straight strong game against the Patriots.
He held that job with Cleveland when the Browns beat the Patriots 34-14 last Nov. 7. Since then, the Patriots had scored at least 30 points in 13 consecutive games. That streak ended Sunday, but New England still won.
Stephen Gostkowski 's 31-yard field goal gave the Patriots a 3-0 lead before Bailey tied it with a 48-yarder. Gostkowski connected again early in the second quarter, this time from 26 yards, before Brady and Wes Welker hooked up on a 5-yard scoring pass. But Romo threw a 1-yard touchdown pass to Jason Witten with 33 seconds left in the half and Dallas trailed 13-10.
Bailey then tied the game with a 22-yard field goal with 5:50 left in the third.
And after Bailey put Dallas ahead for the first time with his final field goal, Brady took over.
"Your margin of error is very, very small at that point," he said. "You can't not get the ball in the end zone."
In those situations, Brady often does.
"When it comes to crunch time," Cowboys linebacker Keith Brooking said, "he is at his best."
Notes: Belichick and Brady have won 116 regular-season games together, tying Miami's Don Shula and Dan Marino for most in NFL history. ... DeMarcus Ware had two sacks for Dallas, giving him seven in five games this season. ... The teams met for the 11th time with the Patriots winning their fourth in a row after losing the first seven. ... Welker had six catches for 45 yards after entering the game with league-leading averages of nine receptions and 148 yards receiving.