Pepe pounces to keep Juve dreaming of Europe
The deflected strike from the Italian winger in the 87th minute was tough on fourth-placed Lazio, who dominated the match but had to play the last nine minutes with 10 men after Cristian Ledesma was sent off.
The result left Lazio on 60 points with three Serie A matches to play - one point above AS Roma and Udinese with seventh-placed Juventus a further three points adrift.
The teams finishing fifth and sixth qualify for the Europa League.
"It was a satisfying win because Lazio played better," Pepe told Sky Italia television.
"They didn't allow us to play and we had to defend for long periods but in the end we showed our spirit and that we are united as a team."
Lazio coach Edy Reja said his side should have been awarded a penalty after a challenge by Giorgio Chiellini on Sergio Floccari midway through the second half.
"There was a clear penalty that would have changed the game," he said.
"Not only are decisions going against us, we seem to be having a lot of bad luck at the moment like the deflection on their goal. But we are still in the Champions League places."
In an opening half controlled by Lazio, two chances in as many minutes fell to Christian Brocchi.
The midfielder had a volley blocked on 25 minutes before a bullet header went wide of the post.
The home team continued to press and striker Floccari forced Gianluigi Buffon into a scrambling save with a low shot six minutes later.
Juventus, though, had the best first-half opportunity when Alessandro Matri's eight-metre shot was blocked by the feet of keeper Fernando Muslera.
Stephan Liechtsteiner then went agonisingly close for Lazio seven minutes into the second half, his half-volley going just over the bar.
With 20 minutes to go the home side upped the tempo and Buffon threw himself to his right to stop a 35-metre piledriver from Hernanes before holding on to another powerful free kick from the Brazilian.
Ledesma was sent off in the 81st minute when he received his second caution of the night for a trip on Felipe Melo.
Pepe then sank Lazio when he controlled a deep cross and his deflected shot beat Muslera.
On Sunday, AC Milan defeated Bologna 1-0 to go eight points clear of second-placed Inter Milan and move to the brink of their first Serie A title in seven years.