FC Barcelona midfielder Ivan Rakitic came off the bench to give his side a 1-0 win at home to Athletic Bilbao on Tuesday.
His effort averted a second consecutive draw which would have further dented the champions’ La Liga title defence.
Barca had slipped off the top of the table after Friday’s 0-0 draw at Sevilla.
They finally found a way through in the 71st minute when Messi slipped the ball into the path of Rakitic, who had only been on the pitch for six minutes.
He kept his nerve to beat Athletic Bilbao’s in-form goalkeeper Unai Simon.
The win took Barca to the top of the standings on 68 points.
Real Madrid, on 65 points, will reclaim their lead due to their superior head-to-head record if they beat Real Mallorca at home on Wednesday.