Messi might have won it with his goal, but it was Ter Stegen who pulled off two crucial saves for the visitors.
Lionel Messi underlined his ability to make the difference on big occasions by hitting a sensational late goal to give Barcelona a 1-0 win at title rivals Atletico Madrid on Sunday as the champions reclaimed top spot in La Liga from Real Madrid.
The Argentine, playing his 701st game for Barca, settled a pulsating and tense encounter in the 86th minute, galloping down the right-wing and cutting inside before playing a one-two with Luis Suarez and guiding the ball into the bottom corner.
It was Messi's 30th goal in 39 competitive games against Atletico and inflicted a first home defeat on Diego Simeone's side since they were beaten by Real Madrid at the Wanda Metropolitano in February.
"Whenever you have a game like this which is really tight and really tough, being able to count on Messi is always an advantage," said Barca coach Ernesto Valverde.
Messi's strike saw Barca return to the top of the standings with 31 points after 14 games, ahead of Real Madrid on goal difference, while Atletico were left in the sixth spot on 25 points, having played one match more than the two pacesetters.
Atleti and Barca hit the woodwork and visiting keeper Marc-Andre ter Stegen made two stunning saves, while the home side felt Gerard Pique should have been shown a second yellow card in the second half for a late tackle on Alvaro Morata.
"We feel very hard done by," said Atletico midfielder Saul Niguez. "We played superbly and Barcelona had hardly any chances but when Messi appears he is capable of doing anything and he made it look so easy, that's why he is the best."
Atleti were also fortunate not to have a player sent off when Vitolo slammed into Pique's knee with a fierce challenge a few minutes later after picking up an earlier booking.
Antoine Griezmann got a hostile reception from the home fans in his first game against his old side since a bitter 120 million euro ($132.26 million) transfer to Barca in the close season and had a poor game, firing his one chance over the bar.
Atleti were under pressure after one win in their previous six games and they made a flying start, nearly going ahead when Barca's Junior Firpo deflected a cross against the far post.
Soon after Ter Stegen pulled off a marvelous save by using his body to thwart Mario Hermoso from point-blank range.
The German then demonstrated outstanding reflexes by swooping to the ground to beat away a header from Morata, while he watched a shot from Hector Herrera fly past the post.
Barca were cagey in their approach for large chunks of the game although Pique hit the bar with a header before the break and Ivan Rakitic scuffed a shot straight at keeper Jan Oblak.
Roared on by 67,000 fans, Atletico looked more likely to snatch a winner but yet again Messi proved the difference.
The Argentine clinched the 2015 La Liga title for Barca with a strike against Atletico and also hit winning goals against them in pivotal games in the 2016/17 and 2017/18 seasons.
His goal here could also prove crucial in what looks set to be a thrilling two-horse race between Barca and Real, who meet on Dec. 18 in the 'Clasico' at the Camp Nou.
"We suffered a little but games like these are the ones which can win you the title," added Barca's Sergi Roberto, who also credited his side's goalkeeper for the win.
"Marc saved two clear goals and Messi decided the game, but this was a triumph for the entire team," he added.