Messi brace gives nine-man Barca win
Racing gave the visitors little space and took the lead after the restart when Nikola Zigic scored from the penalty spot.
Messi's introduction galvanised Barca and the Argentine stole in to score the equaliser within 10 minutes of coming on the pitch, and grabbed the winner nine minutes from time.
Barca, who had Rafael Marquez and Gerard Pique sent off in the closing minutes, restored their 12-point lead at the top of the standings -- moving on to 56 points from 21 games.
"I was pleased with the way we kept control of the ball and did not lose our shape when we went behind. It's an honour to work with these players," Barca coach Pep Guardiola said.
"It's another three points and another small step forward."
Champions Real Madrid, who beat Numancia 2-0 away on Saturday, are second.
Third-placed Sevilla, with 38 points, lost ground on the leaders after losing a bruising encounter 1-0 away to Sporting Gijon in the late game.
Sporting missed a fifth-minute penalty before Diego Castro headed them in front, but they were reduced to 10 men just before the half-hour mark when Roberto Canella was sent off.
King's Cup semi-finalists Sevilla were unable to find a way through their spirited hosts and are now just one point ahead of Valencia, who were led to a 3-2 home win over Almeria by a fit-again David Villa.
The Spain striker scored a penalty and the decider to take his tally for the season to 17.
Villarreal stay fifth with 34 points after falling 3-0 away to Deportivo Coruna, who climbed to sixth.
Guardiola left Messi on the bench at the Sardinero and the side missed his pace as they struggled early on.
The height of Racing striker Zigic was a constant threat at set-pieces and by half-time it was the home side who had come closest to scoring when Jonathan Pereira hit the post.
It was Pereira who drew Marquez into a clumsy challenge for the penalty in the 56th minute and Zigic put Racing ahead from the spot.
Messi came on as a substitute soon after and quickly levelled, arriving at the back post to score after Xavi's header came back off the bar.
Another classic poacher's goal delivered the three points when Messi collected a miscued clearance to race into the area and fire past Tono in the 81st, for his 16th goal of the campaign.
Barca defenders Marquez and Pique were both sent off for second yellow card offences at the end.