FOXBOROUGH, Mass. (AP) — One big comeback, then another.
And now another game for Tom Brady and the New England Patriots.
The quarterback who treats deficits as distractions dug the Patriots out of two 14-point holes — the first team to do that in NFL playoff history — to reach the AFC championship game for the fourth straight year with a 35-31 win over the Baltimore Ravens on Saturday.
"Behind twice by 14 wasn't necessarily in the plan," Brady said. "It took a lot of execution to overcome it."
Thanks to three touchdown passes by Brady and one by college quarterback turned receiver Julian Edelman, the resilient Patriots kept their season alive.
"Right now, it's all about giving us a chance to come to work again," said safety Devin McCourty, who batted down Joe Flacco's desperation pass into the end zone on the last play.
Brady led a masterful march — completing eight of nine passes and running for a first down — to the decisive 23-yard touchdown completion to Brandon LaFell with just over five minutes left to give the Patriots their first lead.
The top-seeded Patriots (13-4) will host the winner of Sunday's Indianapolis-Denver game in the AFC title game. The sixth-seeded Ravens (11-7) had won two of three playoff games in Foxborough over the past five seasons.
"We came to their home field and fought them to the end and we just came up short," said Kamar Aiken, who caught one of Flacco's four touchdown passes.
Brady completed 33 of 50 passes for 367 yards for an offense that picked up just 14 on the ground, the second fewest in team playoff history. His 46 career playoff touchdown passes surpassed Joe Montana's 45 for most in NFL history.
Flacco was 28 for 45 for 292 yards and two interceptions. Justin Forsett gained 129 yards on 24 carries.
Forsett had an outstanding season replacing the Ray Rice, who was suspended and then released for domestic abuse.
"We're all faced with challenges in life," Baltimore coach John Harbaugh said, "and, as a teacher and coach that's what you ask of your guys. I guess what I'm saying is I'm so proud of the way they handled it."
It was a thrilling game of shifting momentum — two touchdowns by the Ravens, the next two by the Patriots, two more by the Ravens and another two by the Patriots.
"We had two separate 14-point leads. Those guys did a good job getting it back to seven as quickly as they could," said Flacco, who threw his first two interceptions in six playoff games. "They don't panic."
Flacco completed his first eight passes, two for touchdowns of 19 yards to Aiken and 9 yards to Steve Smith, to give the Ravens a 14-0 lead. Then the Patriots tied it on a 4-yard run by Brady and his 15-yard pass to Danny Amendola late in the first half.
The Patriots were driving again — until Daryl Smith intercepted Brady, who immediately grasped both sides of his helmet and then bent over in frustration.
"It was just a terrible play by me," he said.
Flacco capitalized with an 11-yard scoring pass to Owen Daniels with 10 seconds left for a 21-14 halftime lead.
And when New England punted on the first series of the third quarter, Baltimore added to its lead on Flacco's fourth scoring pass, a 16-yarder to Forsett, who was wide open in the flat and scored easily.
Then fortunes turned again.
Brady threw a 5-yard touchdown pass to Rob Gronkowski, and the Patriots got the ball back after a punt. This time, another strong arm lifted the Patriots into a tie.
With the ball at the New England 49, Brady threw behind the line of scrimmage to Edelman on the left side. The Kent State quarterback then lofted a deep pass to a wide-open Amendola after cornerback Rashaan Melvin came up toward Edelman.
"We've had it in for 10 weeks, and the coaches finally got to call it," Edelman said. "I had to loosen up the arm a little bit."
After Justin Tucker's 25-yard field goal gave the Ravens a 31-28 lead five minutes into the fourth quarter, the Ravens nearly stopped the Patriots. Brady threw a 9-yard completion to Shane Vereen and officials ruled he fumbled and Baltimore recovered. The call was reversed when replays showed Vereen was down by contact.
Seven plays later, LaFell scored.
Baltimore had two more possessions. The first ended when Duron Harmon intercepted Flacco's deep pass in the end zone with 1:39 left. On the final series, Flacco's desperation pass into the end zone was knocked down as time expired.
"It was a wild game," Patriots coach Bill Belichick said, "but I'm just thankful our players hung in there and made the plays they needed to make."
NOTES: Belichick tied Tom Landry for most postseason wins in NFL history with 20. ... Brady set franchise postseason records with 33 completions and 367 yards passing. ... The Ravens outgained the Patriots 428 yards to 422. ... Patriots center Bryan Stork left the game in the second quarter with a knee injury and didn't return.
AP NFL website: www.pro32.ap.org and www.twitter.com/AP_NFL