PITTSBURGH — Tom Brady and Rob Gronkowski did it to the Pittsburgh Steelers again.

One questionable decision by Ben Roethlisberger — and one stunning call — helped.

Brady fed Gronkowski repeatedly to set up Dion Lewis’ go-ahead 8-yard touchdown with 56 seconds remaining and Roethlisberger was intercepted in the end zone with 5 seconds left — after seconds earlier the Steelers thought they scored the go-ahead touchdown — as the Patriots rallied to beat the Steelers 27-24 on Sunday.

The Patriots (11-3) gained the inside track for homefield advantage in the AFC playoffs by ending Pittsburgh’s eight-game winning streak. Brady threw for 298 yards with two touchdowns and an interception. Gronkowski, fresh off a one-game suspension, finished with nine receptions for 168 yards, including four on the game-winning drive.

It briefly looked like it wouldn’t be enough.

The Steelers (11-3), who played most of the game without injured wide receiver Antonio Brown, appeared to take the lead when Roethlisberger connected with tight end Jesse James for a 10-yard touchdown with 28 seconds to left. The play was overturned on review, with official Tony Corrente saying the ball did not “survive” the completion of the catch.

James had caught the ball and dove for the end zone ball-first. The ball shifted when it hit the end-zone ground, and the most frustrating rules in sports struck again.

Roethlisberger hit Darrius Heyward-Bey for a short gain but stayed in bounds. With the clock running and no timeouts left, Roethlisberger hurried to the line. Rather than spike it to set up a short kick that would have sent the game to overtime, Roethlisberger tried to win it.

Instead, he lost it. His pass to Eli Rogers was batted into the air, and New England safety Duron Harmon came down with it. One kneel-down later the Patriots had their fifth straight victory over the Steelers.

Roethlisberger completed 22 of 30 for 281 yards with two touchdowns and the pick. Le’Veon Bell ran for 117 yards and added another 48 receiving as Pittsburgh hung in there even with Brown, the NFL’s leading receiver, in a hospital having his left calf injury examined.

Steelers coach Mike Tomlin hardly downplayed the pregame hype, welcoming the moment and the pressure that comes along with it even while facing an opponent that he’s beaten just twice during his 11-year tenure and never in a game of true consequence, including a blowout loss in the AFC championship game 11 months ago.

Pittsburgh received an early emotional jolt when cameras cut to injured linebacker Ryan Shazier sitting in a private box less than two weeks removed from spinal stabilization surgery. The crowd at rainy Heinz Field roared as Shazier, who appeared to be seated, waved a Terrible Towel. The 25-year-old is recovering from the surgery on Dec. 6, two days after leaving a Monday night victory over Cincinnati on a stretcher following a routine hit on Bengals wide receiver Josh Malone.

The emotional boost of Shazier’s surprise cameo faded quickly. Brady took a snap, and the reality the Steelers face without their most irreplaceable defensive player set in. Brady took the Patriots right down the field, connecting with Brandin Cooks for a 43-yard gain that set up Rex Burkhead’s 1-yard touchdown.

The Steelers answered immediately on an 18-yard lob from Roethlisberger to Eli Rogers. Pittsburgh took its first lead over the Patriots since 2011 early in the second quarter on a Chris Boswell field goal, one that came at a possibly heavy price. Brown left in obvious pain after getting his left leg tangled up with a pair of New England defenders. He was helped to the medical tent then taken to a hospital for further examination.

Still, Pittsburgh hung around thanks to the depth they didn’t have while getting rolled by New England the last time the AFC superpowers met.

Bryant, suspended all of last season for violating the league’s substance abuse policy, made a pretty one-handed touchdown catch late in the first half that put Pittsburgh up 17-10 at the break. Bell, limited to just 11 snaps in Foxborough last January, churned up clock and yards. JuJu Smith-Schuster, the ebullient rookie wide receiver, caught six passes for 114 yards, including a 69-yard catch-and-run that put the Steelers in position to at least tie it.

Roethlisberger opted to go for the wind instead, a decision now that could have ramifications in January.