Shortly after Gandalf first sees the balrog, he orders Aragorn to lead the fellowship to the bridge. Aragorn hesitates, fearing to leave Gandalf alone against such a fearsome enemy, until Gandalf tells him,
Swords are no more use here!
Moments later when Gandalf and the Balrog are falling into the abyss, Gandalf repeatedly stabs his foe with a sword. We don't see him use any magic against the Balrog. Maybe he did use magic, but we don't see it. His staff appears to be lost or destroyed by then.
As best we can tell, Gandalf defeats the Balrog with a sword.
Obviously I am quoting from the movies and showing scenes from the movies, but I want to know an answer from the books.
Did Gandalf defeat the Balrog with only a sword?