Brady helped lead the Patriots in their comeback win over the Ravens. Reuters

(Reuters) - The New England Patriots fought back from 14-point deficits twice to beat the Baltimore Ravens 35-31 in a thrilling divisional playoff contest as they advanced to the AFC Championship game for the fourth straight year.

The Patriots will now host the winners of Sunday’s game between Denver and Indianapolis with a place in the Super Bowl on the line.

New England did not lead in the game until quarterback Tom Brady connected with Brandon LaFell for a 23-yard touchdown with five minutes to play to give the Patriots their 35-31 advantage.

The score allowed Brady, who threw for three touchdowns, to break Joe Montana’s record of 45 playoff touchdowns.

The Ravens, who twice since 2000 had beaten the Patriots in playoff games, demonstrated their intent on the game's first drive with Joe Flacco leading them on a five-play, 71-yard drive culminating in a 19-yard touchdown pass to Kamar Aiken.

The freezing Foxborough crowd were stunned when, on their second possession, the Ravens scored again, Flacco, who threw for four touchdowns in the game, finding Steve Smith who beat Patriots cornerback Darrelle Revis on a slant.

Brady, who passed for 367 yards, brought the Patriots back with a clever four-yard touchdown run.

New England pulled level at 14-14 when Brady found Danny Amendola with a 15-yard touchdown pass, the receiver evading a tackle before a spectacular dive into the end zone.

If Baltimore were downhearted, they showed no signs of it with Daryl Smith showing great awareness to intercept a Brady pass towards Rob Gronkowski.

From the resulting possession, the Ravens advanced down the field with the confident Flacco splitting two Patriots defenders to find Owen Daniels and send Baltimore in at the half with a 21-14 lead.

Busted coverage from the Patriots defense allowed Flacco to find a wide-open Justin Forsett with a 16-yard touchdown pass that he ran in unchallenged in the third quarter.

Once again New England had dug themselves a 14-point hole.

But Brady found Gronkowski for a five-yard touchdown and then the Ravens were caught out by a brilliantly worked play as Brady passed back to receiver Julian Edelman and the former college quarterback threw a 51-yard pass to Amendola.

The Ravens’ attempt at a comeback was effectively ended when a long throw from Flacco towards Torrey Smith in the end zone was picked off by Duron Harmon.

(Reporting by Simon Evans in Sheboygan, Wisconsin, editing by Gene Cherry)