Barcelona withstood a scare to beat Valencia 3-2 and set up a grandstand Camp Nou clash with LaLiga leaders Atletico Madrid next weekend.
Lionel Messi missed a penalty but scored twice, including a sublime free-kick, with Antoine Griezmann also on target at Mestalla.
The Barcelona goals came after the jolt of conceding early in the second half when Gabriel Paulista headed in from a corner to give the hosts the lead, with visiting boss Ronald Koeman banned from the touchline after his dismissal in the shock defeat to Granada.
Carlos Soler drove in a spectacular late second for Valencia, but Barcelona's success means they are back to just two points behind Atletico, and level again with Real Madrid, as the saga of the title race heads for a thrilling conclusion.
Pedri wasted a great chance in the third minute as he shot wide of the right post after being teed up by Frenkie de Jong, and Ronald Araujo's effort on the stretch from a teasing Messi free-kick was blocked away by goalkeeper Jasper Cillessen.
Valencia's Goncalo Guedes should have scored early in the second half but allowed Marc-Andre ter Stegen to push his shot wide for a corner. However, Gabriel made no mistake when Soler swept the set-piece delivery across from the left, heading in at the far post.
Barcelona drew level in the 57th minute through Messi, despite him failing from the spot. Toni Lato conceded the spot-kick after jabbing his right arm at a floated Messi pass, and although the Argentinian saw his tame penalty parried by Cillessen, Pedri's shot as the ball pinged around the box was deflected to Barcelona's record scorer, who netted from close range.
The visitors went ahead six minutes later when De Jong's powerful header from Jordi Alba's cross was well saved by Cillessen but palmed only as far as Griezmann, who tucked home.
Messi's second goal was a 69th-minute curling free-kick from a central starting point that found the back of the net via the inside of the right post, giving the goalkeeper little chance, a speciality of Barca's captain.
It was arguably topped by Soler's brilliant long-range finish in the 83rd minute, but Valencia could not find a leveller.