Ballerini (XDS Astana Team) comfortably beat Belgium's Jasper Stuyven (Soudal Quick-Step) on the city-centre finish after a flat 142km ride from Paestum.
A relatively incident-free stage burst into life in the final kilometres as the sprinters moved into position.
But with light rain making the surface treacherous, a crash inside the final kilometre on a sharp turn took down Dylan Groenewegen (Unibet Rose Rockets) and several other riders while Italy's Jonathan Milan (Lidl-Trek) was forced to a standstill.
A disappointed Milan questioned the choice of route.
"I don't know why we have to find these complicated finishes, why can't we go just straight?" he said.
"With two drops of water, you get a huge mess. I'm disappointed as I was in a good position."
Groenewegen was more measured, saying it was just bad luck.
"It was a bit slippery, and it can happen," he said. "It's disappointing. Sometimes you have bad luck."
Ballerini and Stuyven managed to avoid the late crash and powered to the line with Ballerini proving too strong as he took his first stage win on the Giro d'Italia.
France's Paul Magnier was third.
"I was thinking to win one stage in the Giro, but today was not actually on the plan," the 31-year-old Ballerini said.
"But when the crash happened, I saw a gap, and I made it."
After a relaxing day for the general classification contenders, the battle will resume on Friday with Portugal's Afonso Eulalio (Bahrain Victorious) still in the pink jersey with a two-minute, 51-second lead over Spain's Igor Arrieta (UAE Team Emirates XRG) after they finished safely in the bunch.
Stage seven from Formia is one of the toughest on this year's Giro with a 244km route ending with a 13.6km climb to the Blockhaus mountain in the Apennines.
Friday's stage could see the first big move from race favourite Jonas Vingegaard, who is currently lying 15th, six minutes behind surprise leader Eulalio.
