LaLiga's leaders twice went behind only for their captain to drag them ahead as he took his personal tally to 36 goals against Sevilla in all competitions, before Luis Suarez netted a late fourth.
Jesus Navas and Gabriel Mercado had put Pablo Machin's side in the ascendancy, but a fourth game without a win has dealt serious damage to their Champions League ambitions.
A bold Barca line-up that included Suarez, Philippe Coutinho and Messi in attack proved susceptible to the Sevilla counter-attack, with Navas marking his 300th LaLiga start with a precise finish after Wissam Ben Yedder sent him clear in the box.
Sevilla's lead lasted only four minutes, though, with Messi blasting in a fine volley from near the edge of the box after Ivan Rakitic was given time to cross from the left.
Barca continued to struggle against the Sevilla press and they found themselves behind again before the break. Ter Stegen was forced into a hasty clearance, Pablo Sarabia ran towards the byline and, as the visiting defence seemed to expect the ball to be going behind, Sarabia cut it back for Mercado to sweep home.
Ernesto Valverde brought on Sergi Roberto and Ousmane Dembele at the break and the changes should have paid dividends early in the second half, but Dembele failed to make clean contact with the ball after being teed up by Suarez.
It was an error from goalkeeper Tomas Vaclik that allowed Barca to level once more. Rakitic cut out his clearance and found Dembele, he squared to Messi, and the captain curled a right-foot strike high into the net.
With only five minutes of normal time left, Messi clipped the ball over Vaclik to put Barca ahead after Carles Alena's shot deflected into his path, and he sent Suarez through to lob the keeper in style and seal the win in injury time.
Barca stay in control of title race
Barca's lead at the top is back to 10 points, meaning Atletico Madrid need a victory over Real Sociedad on Sunday to keep up the pressure.
It also sets up Valverde's side nicely for a daunting week in which they visit Real Madrid twice, first in the Copa del Rey and then in the league.
The defeat is particularly bad news for Sevilla, with Getafe having moved ahead of them into the Champions League places by beating Rayo Vallecano earlier.
Messi denies Sevilla yet again
Messi has now scored 23 goals in his last 21 appearances against Sevilla in all competitions. As those around him failed to fire, he was once again the difference between a draw and a victory.