Earlier, Antoine Griezmann scored a stunning free-kick as Atletico Madrid compounded a week to forget for Sevilla with a 3-1 at the Vicente Calderon yesterday.
Barca needed to come from behind to keep the pressure on Madrid as Eliaquim Mangala headed Valencia in front.
But the on-loan Manchester City defender was sent-off for pulling down Luis Suarez after the Uruguayan had levelled and Messi smashed home the resulting penalty.
Madrid still also have a game in hand over their title rivals.
More From This Section
Outgoing Barca coach Luis Enrique named the same side that beat Paris Saint-Germain 6-1 10 days ago to progress to the Champions League quarter-finals in stunning fashion.
And whilst not matching that drama, there was no shortage of action as Valencia showed up the defensive flaws in Enrique's new 3-4-3 system.
Messi had already had an effort cleared off the line, whilst Mats-Andre ter Stegen made a stunning save from Carlos Soler at the other end before an action packed final 15 minutes of the first-half saw four goals and a red card.
The lead lasted just six minutes as Suarez raced onto Neymar's throw-in to slot into the far corner.
Mangala went from hero to villain as he then pulled down Suarez inside the area to concede a penalty and be sent-off.
Messi beat penalty specialist Diego Alves from the spot.
However, straight from kick-off Barca were caught cold as Jose Gaya teed up Munir El Haddadi to score against his parent club for the second time this season.
Messi drilled home at Alves's near post seven minutes into the second period for his 41st goal of the season.
Suarez somehow slotted wide with the goal gaping after Alves had denied Messi his hat-trick, whilst Neymar hit the bar.
At the Calderon, Griezmann shone for Atletico once more as he teed up Diego Godin's opener and then struck a stunning free-kick for his 22nd goal of the season.
Koke added Atletico's third before Joaquin Correa registered a consolation for Sevilla.
A third straight league win moves Diego Simeone's men seven points clear of Real Sociedad and Villarreal in the battle for fourth.
"Sevilla have had a magnificent season and have been lauded by the press. That highlights even more how well Atletico played," said Atletico coach Diego Simeone.
And the Atletico fans also celebrated the return of Fernando Torres for the first time since he was knocked unconscious in a sickening head clash at Deportivo la Coruna on March 2.
And coach Jorge Sampaoli claimed he has to rediscover the "real Sevilla" during the international break after four games without a win.
"Logically the league is now a long way off. Now we have to look at the possibility of automatically qualifying for the Champions League," said the Argentine.
"It is normal when you don't achieve what you want, which is to win, there is frustration and bitterness.
"We have come from a very hard blow to take and now we have to find solutions and the real Sevilla.