BATON ROUGE, La. — With Alabama’s hopes of a second straight national title hanging by a thread, A.J. McCarron shook off a dismal second half and guided the Crimson Tide down the field.

McCarron read blitz and flipped a swing pass to T.J. Yeldon, who did the rest on a 28-yard touchdown with 51 seconds remaining that gave the top-ranked Crimson Tide a 21-17 victory over No. 5 Louisiana State.

Alabama (9-0, 6-0) now has a clear path to the Southeastern Conference championship game in Atlanta. But this one was a struggle.

Led by quarterback Zach Mettenberger, LSU (7-2, 3-2) fought back from a 14-3 halftime deficit. Jeremy Hill scored on a 1-yard run late in the third quarter, LSU’s first TD against Alabama since 2010 — a span of nearly three full games. Then Mettenberger hooked up with Jarvis Landry on a 14-yard touchdown that put the Tigers ahead 17-14 with just under 13 minutes remaining.

LSU was on the verge of putting the game away, driving into Alabama territory and forcing coach Nick Saban to call his remaining timeouts. But Drew Alleman missed a 38-yard field-goal attempt, and McCarron took over from there.

“I wish I had a couple of my calls back,” LSU coach Les Miles said. “That’s the way it goes.”

Before the final drive, McCarron was 1 of 7 for 0 yards in the second half. But he guided the Crimson Tide on a 72-yard drive, connecting with Kevin Norwood on three straight passes covering 18, 15 and 11 yards. Then, when LSU brought a corner blitz, he got the ball away quickly to Yeldon. The freshman running back broke one tackle and faked out another defender, racing to the end zone for the winning score.