Ousmane Dembele thumped in a 90th-minute winner as Barcelona beat Real Valladolid 1-0 and cut Atletico Madrid's advantage at the top of LaLiga to a solitary point.
Ronald Koeman's resurgent side had won their previous five top-flight matches but were short of their best for much of the first half, with Kenan Kodro hitting the crossbar for Valladolid.
Lionel Messi and his team-mates tried to crank through the gears in the second half but struggled to find a breakthrough, even after Oscar Plano was sent off 11 minutes from time for a cynical foul on Dembele.
The France winger would have the final word, swiping home on the volley after Ronald Araujo made a nuisance of himself on the end of Frenkie de Jong's cross - setting up next weekend's pivotal Clasico showdown perfectly.
Barcelona goalkeeper Marc-Andre ter Stegen was back in action for the first time since Germany's humiliating 2-1 defeat to North Macedonia and he was relieved to see Kodro's header cannon to safety off the bar.
Messi won a free-kick in the 15th minute and clipped wide but the visitors continued to acquit themselves well.
Roque Mesa grazed the top of the netting with a speculative strike before Barca let the playmaker run unchallenged for around 30 yards to blast over.
Barcelona belatedly found some rhythm before the interval and Pedri linked up nicely with Messi to fire in a rasping low drive that Jordi Masip tipped against the right post.
Koeman's front three were all involved before the hour – Messi releasing Dembele to draw a brilliant low stop from Masip, with Antoine Griezmann sending an improvised diving header wide on the rebound.
Jordi Alba survived appeals for a penalty after the ball flicked off his hand inside the Barca box and Plano sliced wide on another threatening break.
A yellow card would arguably have been suffice for Plano's petulance and Valladolid buckled at the last in what felt like a huge moment in the title race.