Michu put Rayo ahead after 11 minutes only for Llorente to equalise five minutes later by heading home Inigo Perez's free-kick.
The Spain international then put the visitors 2-1 in front with a wonderful turn and finish, but Alejandro Arribas took advantage of Gorka Iraizoz's error to make it 2-2 four minutes later.
Rayo then passed up a host of glorious opportunities either side of the break and were punished as Llorente powered home the winner midway through the second half.
Marcelo Bielsa opted to rest several first-team regulars ahead of this week's Copa del Rey semi-final and it was the absence of Javi Martinez at the heart of the defence that seemed to be the biggest miss as Rayo opened up the visitors at will in the first period.
Michu fired in his ninth league goal of the season as Roberto Trashorras' corner was flicked on at the near post on 11 minutes.
The lead only lasted for five minutes, though, as Perez's fantastic ball into the box required just a touch from Llorente to take it past Dani Gonzalez.
Llorente's strength was proving too much for Rayo's makeshift central defensive pair of Arribas and Mikel Labaka and he got his second of the day 22 minutes in as he collected a long ball on his chest and turned Labaka before clinically striking the ball into the far corner.
Iraizoz was also experiencing a difficult afternoon in the Athletic goal, though, and when he spilled Labaka's shot Arribas was on hand to tap in the equaliser.
The Athletic keeper redeemed himself by turning away Jose Movilla's well-struck shot from outside the box but was lucky to get away with another howler shortly before the break as Michu intercepted his clearance but delayed and allowed the keeper to knock the ball to safety.
The end-to-end action continued after the break as Michu again pounced on an Iraizoz spill but his touch took him too wide and his eventual cut-back was wastefully fired over by Trashorras.
And that miss was to prove the turning point as two minutes later Athletic grabbed the winner. Gaizka Toquero found space down the right and his cross was headed firmly into the corner by Llorente, although substitute goalkeeper David Cobeno will be disappointed not to have pushed the effort wide.
The hosts still had chances to salvage a point as Rayco somehow failed to connect with Piti's cross and Trashorras was twice denied by Iraizoz, but Athletic held on to record only their third away win of the season.