By Daniella Matar, AP

MILAN — Napoli got back on track by beating nearest rival Roma 2-1, leaving Serie A leader Juventus with the biggest smile on Saturday.

Napoli remained third but closed the gap to second-placed Roma to two points.

Juventus can stretch its advantage to 10 points with a win at struggling Udinese on Sunday.

“We must be realistic, the title race was very difficult before, now it’s almost impossible,” Roma coach Luciano Spalletti said. “It will depend what Juventus do, but it’s very hard.

“When you lose these head-to-head games, your spirit also sinks.”

Napoli was all but out of the Champions League and Italian Cup after 3-1 defeats to Real Madrid and Juventus in the first legs. Alongside a home loss to Atalanta last weekend, Napoli’s season threatened to implode. The match with Roma was billed not only as a fight for an automatic Champions League spot, but also a fight between two contenders for league top-scorer: Dries Mertens and Edin Dzeko.

Mertens came out on top with two goals. He broke the deadlock in the first half, springing the offside trap to run onto a delightful through ball from Marek Hamsik and dink it over Roma goalkeeper Wojciech Szczesny. Mertens celebrated in unusual fashion, by getting down on all fours, cocking his leg, and pretending to urinate on the corner flag. A second score before halftime was ruled out for his push on Federico Fazio. His second came five minutes after the break, when he rushed in at the back post to tap in Lorenzo Inisgne’s cross.

His 18th league goal moved him within one of Dzeko, Torino’s Andrea Belotti, and Juventus forward — and former Napoli star — Gonzalo Higuain.

It was almost worse for Roma as Daniele de Rossi was lucky not to receive a second yellow card 20 minutes from time when he kicked Pepe Reina in the back of the leg from the ground following a collision with the Napoli goalkeeper. It was not spotted by officials but Napoli coach Maurizio Sarri was sent to the stands for dissent.

Mohamed Salah hit the left post and Roma finally scored in the 89th as Diego Perotti burst down the left and pulled back for Kevin Strootman to drive into the bottom right corner.