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 Alvarez 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.