The Polish forward managed to divert Raphinha’s cross home at the death to pull Barcelona level on 31 points with Real Madrid at the top of the table, before the champions host Girona on Sunday.
It was a hard-fought win – the Catalans lost centre-backs Jules Kounde and Eric Garcia to injury, and they will be worries for their national teams, France and Spain respectively, ahead of the Qatar World Cup which starts in under three weeks.
Valencia saw Uruguayan Edinson Cavani go off injured with an ankle problem too, with the game billed as a shoot-out between him and fellow veteran marksman Lewandowski, who came out on top with his late goal.
Gennaro Gattuso said he and Barcelona counterpart Xavi Hernandez played almost different sports in their playing days, but their teams were evenly matched at a feisty Mestalla.
The visitors had the upper hand from the start, although Valencia’s tricky forward line caused them concern at the back, with Samuel Lino and Justin Kluivert particularly hard to handle.
Ansu Fati should have opened the scoring when set up by a perfectly timed Pedri pass, but onrushing Valencia goalkeeper Giorgi Mamardashvili saved the forward’s attempted dink with his face.
Frenkie de Jong hammered an effort wide from distance, while Fati, on a rare start, could not direct a header from Ousmane Dembele’s cross low enough to cause problems.
Valencia thought they had broken the deadlock early in the second half when Lino slid home but Marcos Andre hand handled a cross into his path and the goal was disallowed.
– Late winner –
Barcelona could have won the match with five minutes remaining but substitute Torres fluffed his lines in front of goal, kicking the ball against his other leg when he only had the goalkeeper to beat.
Luckily for him, master finisher Lewandowski spared his blushes with a goal when Barcelona needed it most.
Earlier Ruben Sobrino bundled home a dramatic last gasp winner to earn Cadiz a remarkable 3-2 win over Atletico Madrid, piling the misery on the visitors in a harrowing week for Diego Simeone’s team.
It looked like Joao Felix had salvaged the Rojiblancos a point from two goals down, with a stunning impact off the bench, forcing an own goal and scoring another effort himself, stemming the bleeding after their Champions League elimination on Wednesday.
“It’s all learning, you always keep learning, there’s no time not to learn,” said Simeone.
“We have to keep going mentally, it seems like it’s all going to end tomorrow, and there’s a long way to go in La Liga, we can get into the Europa League, so let’s have some calm.
“Even though the luck that you always need in this game is not favouring us.”
Jorge Sampaoli’s Sevilla, 17th, fell to a disappointing 1-0 defeat at home against Rayo Vallecano, while Almeria beat Celta Vigo 3-1.