Ivan Rakitic came to Barcelona's rescue as the substitute fired Quique Setien's side to a 1-0 win over Athletic Bilbao.
All eyes were on Lionel Messi, chasing his 700th career goal, but he had to settle for an assist to Rakitic's 71st-minute strike that lifted Barcelona back above Real Madrid.
Amid Messi's pursuit of a slice of history, a drought had looked to be undermining Barcelona's LaLiga title bid until the late twist.
After a goalless draw at Sevilla on Friday, Barcelona were far from their best again.
The biggest impact Messi made until his assist for the goal was arguably the one he left on Yeray Alvarez's ankle in what was perhaps generously considered an innocent collision.
He threatened to steal the headlines in the closing minutes when he darted in from the right flank, the ball on his left foot, and took aim for the far corner.
It is a goal that Messi has scored so many times in his career, but this time the fierce shot flew wide of the left upright. Ansu Fati, meanwhile, hit the right post from close range in stoppage time.
The chances were not all Barcelona's though, with Marc-Andre ter Stegen almost caught out in the opening moments of the game when Unai Lopez's snappy cross from a short corner on the left nearly arrowed into the far corner.
Ter Stegen just got there in time, but the goalkeeper was struggling midway through the first half when Yeray connected with Lopez's teasing free-kick. Ter Stegen and Barca were thankful the defender sent his header over the bar.
After the break, Messi teed up Antoine Griezmann with a clever pass, but the French forward could not apply a suitable finish.
Eventually the breakthrough came as Messi teased the ball through for the charging Rakitic to slam beyond Unai Simon.
Luis Suarez suddenly looked energised and saw a thumping shot deflect over for a corner. The ineffective Griezmann had already made way, his drought now up to seven league games.
Then came the moment when Messi should have completed another century of goals, but the landmark will have to wait.
What does it mean? The lead changes hands
Barcelona go three points clear of Real Madrid for now, having been second on head-to-head record going into this game. Madrid face struggling Real Mallorca on Wednesday, so are expected to reclaim top spot.
Athletic, meanwhile, are enduring a mid-table campaign but at least competed well here.
Grim again from Griezmann
Griezmann last went seven games without a goal in late 2016, amid a nine-game barren streak for Atletico Madrid. He emerged from that to re-establish himself among LaLiga’s most-feared forwards, so Barca will hope the same applies this time. But the 29-year-old was worryingly flat in this game, fluffed his one big chance and was hooked by Setien midway through the second half.
Visitors unfortunate to lose
Athletic defended doggedly and could count themselves unfortunate to miss out on a point, with Yeray particularly impressive. What he did not deserve was the challenge from Messi that caught him around the ankle. Messi will be flooded with cards when he turns 33 on Wednesday. He surely should have had one here, too, perhaps red.
Barcelona will hope to prove sharper when they travel to face lowly Celta Vigo on Saturday. Athletic face Mallorca on the same day.