MILAN (AP) — Napoli kept its slim Serie A title hopes alive with a 3-2 win over Atalanta on Sunday, while AC Milan maintained its challenge for second by beating struggling Palermo 2-0, with both goals coming from Mario Balotelli.

Goran Pandev scored the winner for Napoli nine minutes from time after it had twice been pegged back by Atalanta.

Edison Cavani scored the other two, breaking a drought of eight games in all competitions — the longest in his time at Napoli.

"It was important to get back to winning ways, as we did not deserve to be in this difficult moment," Cavani said. "Now we must enjoy this victory, which will allow us to work in a more relaxed environment. We are doing well and want to go as far as possible."

Milan bounced back from a 4-0 Champions League loss at Barcelona as Balotelli fired home an early penalty before doubling his tally in the second half with his seventh goal in six games since his arrival from Manchester City.

"We won, which was the important thing," Balotelli said. "It went badly in Barcelona, but we have recovered."

They both still have a long way to go to get anywhere near Francesco Totti's tally after the Roma captain scored his 226th league goal in Roma's 2-0 win over Parma.

Totti has now surpassed former Swedish great Gunnar Nordahl's tally and is alone in second place on Serie A's all-time scoring list, 48 behind Silvio Piola's record.

Napoli is nine points behind defending champion Juventus, with Milan two points further back, with nine rounds remaining.

"It doesn't matter, we will catch Napoli next week," Balotelli added. "We must continue working as a squad. We might not play like Barcelona, but we can reach their level, as we beat them at San Siro."

Elsewhere, Fiorentina beat 10-man Genoa 3-2 to keep its Champions League hopes alive.

After Juventus beat Bologna 2-0 to move provisionally 12 points clear on Saturday, Napoli — which had picked up just four points in five games — knew it needed a victory to stay in touch.

It got off to a great start when Cavani converted a penalty following Luigi Giorgi's foul on Juan Camilo Zuniga after just three minutes.

Atalanta leveled with a bizarre own goal from Paolo Cannavaro. German Denis' cross was comically miskicked by Giacomo Bonaventura from five yards but he backheeled it onto Cannavaro and it ricocheted into the net.

Cavani restored Napoli's lead in the 65th, squeezing a shot in between two defenders for his 20th league goal of the season.

It looked as if Denis had ended his old club's title hopes when he leveled eight minuted later, but Pandev sidefooted home a late winner for his first goal since October.

Milan also got off to the perfect start when Balotelli won and scored an eighth-minute penalty after he was pulled down by Salvatore Aronica.

Cristian Zapata was lucky not to get sent off in the 32nd minute when he cleared Paulo Dybala's long ball with his arm. Zapata was the last man and appeared to have prevented a clear goalscoring chance but the referee only showed him a yellow card.

Balotelli doubled his tally in the 66th, tapping in from close range after Palermo goalkeeper Stefano Sorrentino spilled M'Baye Niang's cross.

Palermo remains rooted to the bottom of the table, as its miserable week continued following a fourth coaching change.

Desperate to avoid relegation, the last-place club rehired Giuseppe Sannino on Tuesday but it remains five points off Genoa, which is still very much in danger after a third successive defeat.

Alberto Aquilani returned from a ban to give Fiorentina a 33rd-minute lead.

Daniele Portanova headed in the equalizer in the 58th but Fiorentina was back in front four minutes later when Alexandros Tzorvas dropped Manuel Pasqual's cross and Juan Cuadrado tapped it into the net.

Luca Antonelli leveled again for Genoa but it was forced to play the last 15 minutes with 10 men after Andrea Bertolacci was sent off following a second booking.

Moments later a corner went in off Genoa defender Mattia Cassani's shoulder and Fiorentina held on for victory, which keeps it three points behind Milan.

Inter Milan is also in the running for the final Champions League spot, but its game at Sampdoria was postponed due to bad weather. Torino's match went ahead in heavy snowfall as it beat 10-man Lazio 1-0. Substitute Jonathas scored with his first touch of the game, 12 minutes from time.

The snow was so bad that play had to be halted for several minutes during the second half to clear the lines around the goal and penalty area.

Lazio played with 10 men for 75 minutes after Michael Ciani was booked twice in 43 seconds.

Roma, Lazio and Inter are all level on 47 points.

Erik Lamela gave Roma a seventh-minute lead before Totti's historic second-half goal from a free kick.

Totti and Simone Perrotta hit the crossbar for Roma, while Gabriel Paletta did so for Parma.

Siena, which started the season with a six-point penalty following a match-fixing scandal, is now just a point behind Genoa after a drab goalless draw against Cagliari, earlier on Sunday.

Pescara, which is level at the bottom of the table with Palermo, lost 2-0 at home to Chievo Verona with very late goals from Adrian Stoian and Cyril Thereau.