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 right down the field.

McCarron read an LSU 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 LSU.

Alabama (9-0, 6-0 Southeastern Conference) now has a clear path to the league championship game in Atlanta and remains solidly on course to defend its national title in Miami.

But this one was a struggle. Led by embattled quarterback Zach Mettenberger, LSU (7-2, 3-2) fought back from a 14-3 halftime deficit with an offensive performance that was nothing like its dismal showing against the Tide in last season's BCS championship game.

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 threw perhaps the best pass of his LSU career, hooking 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, and McCarron took over from there.

He completed three straight passes to put Alabama in scoring position. 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.

LSU coach Les Miles kept reaching into his bag of tricks -- and kept getting burned. A fake field goal was stuffed. An onside kick didn't work. And going for it on fourth down in Alabama territory didn't work out either.

"I wish I had a couple of my calls back," Miles said. "That's the way it goes."

Mettenberger finished 24 of 35 for 298 yards, with 14 of those completions for 202 yards coming over the final two quarters.