Although Gandalf is "magic elf", he is not an elf within the Tolkien universe, moreso a angel-like being placed into a mortal body (known as a Maiar).
However, both possess many objects created via Elven craftsmanship.
Odin sports Gungnir, a spear, and Gandalf, Glamdring, also known as the Foehammer.
Odin has a great ring known as Draupnir, while Gandalf is gifted one of the three great elven rings, Narya, to help the commonfolk not come into times of despair and resist domination.
Both figures have moments where they completely turn the tide of battle against their opposition. Here are two major points during their history where a battle swung in their favor due to their arrival.
Promising his return on the fifth day, Gandalf and Theoden's son Eomer arrived with thousands of cavalry to save the Battle of Helm's Deep, the climax of the second book, The Two Towers.
Using light to blind the Uruk-hai, their charge let help fall the reign of Saruman in the Western region of Middle-Earth.
In the story of King Sigmund versus King Lyngvi, Sigmund sought the hand in marriage of Hjordis, a wise and beautiful princess. King Lyngvi was jealous of her choice and as a result, decided to send his army to attack Sigmund's.
At the peak of the battle, Odin, appearing as a typical old man, wrapped in a cloak and with his one eye, entered the fray. He came upon King Sigmund, raising his spear, the two clashed. Sigmund struck the sword, and as a turn of events, the sword shattered. The sword, which Odin had placed in the tree Barnstock and that Sigmund had been chosen to wield, had finally failed him.
The tide of the battle immediately turned against Sigmund, Odin, who had been known to choose the winners of these encounters, had felt that Sigmund was no longer fit to rule
In, The Fellowship of the Ring, Gandalf would fall victim while allowing the rest of the company to escape to the Balrog of Moria.
Gandalf would fight Durin's Bane for twelve days on the Endless Stairs before becoming the victor of their duel, but eventually dying for the first time in his long life.
He would be brought back by Eru, the God of Middle - Earth, as Gandalf the White