Sam quickly shoots one ghost with his blue fireball. After that he got away from that place. Those four remaining ghosts tried to attack him, but he avoided their attack. But he wasn't slow and instantly turned around and fired one more fireball. Only two ghosts were able to react quickly and avoided that attack and the remaining got hit by the fireball. Instantly those two ghosts began to scream and at the end they got turned into Ash.
Sam at this time quickly shoots more fireballs toward those remaining two ghosts. Even though they were able to react on time, they did not escape from all those fireballs and at the end they got killed by that. You have to say that the fireball made out of pure spiritual energy was really very powerful. It did not even take a second to kill the ghosts.