Quarterback Joe Flacco and the Ravens will visit the Patriots at Gillette Stadium next Saturday. (NFL Game Rewind)

Quarterback Joe Flacco and the Ravens will visit the Patriots at Gillette Stadium next Saturday. (NFL Game Rewind)

The Baltimore Ravens earned a trip to Foxborough with a 30-17 victory over the Pittsburgh Steelers on Saturday night.

With 11 minutes remaining in the fourth quarter, the third-seeded Steelers cut the deficit to five, after a 44-yard pass to All-Pro receiver Antonio Brown set up a six-yard touchdown fade to rookie Martavis Bryant. But Pittsburgh would not edge closer at Heinz Field.

Baltimore’s front seven connected with Steelers quarterback Ben Roethlisberger for five sacks, while Ravens quarterback Joe Flacco was sacked once and went 18-of-29 passing for 259 yards.

Flacco connected with wideout Steve Smith Sr. for 101 yards and Torrey Smith for an 11-yard touchdown. And after a 52-yard field goal by Justin Tucker extended the lead to eight, Flacco found rookie tight end Crockett Gilmore for a 21-yard score on the Ravens’ following possession.

An interception down in the red zone would seal the AFC wild-card contest with just over three minutes remaining. Yet a blocked punt and safety would cut the difference to 13 before it was over.

With the win, the sixth-seeded Ravens have survived to encounter the top-seeded New England Patriots at Gillette Stadium for a 4:35 p.m. kickoff next Saturday. The divisional-round game will mark the fourth time Baltimore and New England have crossed paths in the playoffs since January of 2010.

The Patriots have gone 1-2 in those games, but defeated the Ravens by a score of 41-7 in their last meeting during the 2013 regular season.