Barcelona had been unusually below-par at the Ramon Sanchez-Pizjuan and were lucky to only be two goals behind as the game entered the 88th minute.
But Luis Suarez – who had been so wasteful for the visitors – then halved the deficit and 53 seconds later Messi earned a point, the Argentine superstar beating Sergio Rico from 20 yards to cap his return from injury in an astonishing finish to the contest.
It was harsh on Sevilla who had dominated proceedings and deservedly led through strikes in either half from Franco Vazquez and Luis Muriel.
But they were made to rue wasted chances from that duo and Jesus Navas as Barca showed why they are the top side in Spain this season.
The draw edges Ernesto Valverde's side closer to the title – now 12 points clear of closest challengers Atletico Madrid - and leaves them one game short of equalling Real Sociedad's unbeaten record in the competition.
And breathe...— FC Barcelona (@FCBarcelona) March 31, 2018
Barcelona rued the absence of Messi in the opening half as Suarez and Andres Iniesta lacked the quality in front of goal that their Argentine team-mate is renowned for.
Suarez saw an early chance saved by Sergio Rico and blasted another wide soon after, the Uruguayan's openings coming after Iniesta had failed to test the Sevilla goalkeeper.
At the other end Ter Stegen's goal led a charmed life as Luis Muriel and Joaquin Correa both headed wide under little pressure from the Barca defence.
Vazquez showed much more composure with 36 minutes on the clock as Barca gave him the freedom of the six-yard box, the attacking midfielder slotting home Correa's low cross.
Gerard Pique should have levelled things up seconds before the break but he inexplicably chose to try and volley Samuel Umtiti's deflected cross rather than use his head – the defender failing to connect at the back post.
The hosts used the let-off to put Barca further behind five minutes after the restart, Muriel firing beyond Ter Stegen after the goalkeeper could only parry Sergio Escudero's shot.
As Messi warmed up, Sevilla should have been three in front when Navas raced through one-on-one, but Ter Stegen held him up momentarily before Pique cleared his shot off the line.
The loose ball then fell to Vazquez and he was unable to convert from 12 yards.
Valverde introduced Messi – who missed Argentina's two friendlies with a hamstring problem – just before the hour and he gave the visitors much more quality in the final third.
He was immediately involved to release Philippe Coutinho but Simon Kjaer intercepted the Brazilian's low cross before Suarez could tap home.
Another chance saw Suarez hit the post from a tight angle, but Sevilla still posed more of an attacking threat – Muriel and substitute Miguel Layun both wasting good openings.
And they proved costly as Suarez finally beat Rico with an acrobatic effort, with more drama to come in the visitors' next attack.
Messi – it had to be him – snatched a point Barca scarcely deserved with a curling effort that Rico could only get a hand to as the league leaders completed an unlikely recovery.
Key Opta Stats:
- Lionel Messi has scored 24 goals against Sevilla in LaLiga, his favourite opponents in the competition.
- Barcelona have won more points from losing positions than any other side in LaLiga this season (17).
- Messi is the player with the most goals from outside the box in Europe's top five leagues this season, alongside Paulo Dybala (seven apiece).
- Barcelona faced 21 shots against Sevilla, more than in any other game this season in all competitions.
- Messi has scored nine goals in his last 13 games as a substitute in LaLiga.
- Luis Suarez has scored 25 or more goals in each of his four seasons for Barcelona.