Multiple gods fought at the Battle of Marathon or, at least, that's what the Athenians claimed.

According to Athenian legend, several gods and heroes fought against the Persians at the Battle of Marathon. These included Pan, Artemis, Athena, a ghost warrior, the obscure god Echetlaeus, as well as the heroes Theseus, and Heracles. These divine interventions and supernatural accounts, recorded by historians like Herodotus and Pausanias, reveal how the battle evolved into an Athenian foundational myth.

If Herodotus wrote his Histories sometime around the second half of the 5th century, then a considerable amount of time had passed since 490 BCE, when the Athenians, with help from the city of Plataea had defeated a Persian army at the battle of Marathon. By that time, the veterans of Marathon would have been quite old and Marathon had become a legendary battle.
The divine interventions and supernatural events described by the veterans and recorded by Herodotus and subsequent authors like Pausanias, signify the role that Marathon played in the Athenian collective memory as a central event with larger than life heroes and episodes. By all accounts, by the time of Herodotus the battle of Marathon had grown to become the Athenian mythomoteur, the narrative that propelled the city-state to establish its own empire in the Aegean.
To understand the importance of Marathon within Athenian memory, it is enough to say that according to the ancient source, the epigram on Aeschylus' tomb only mentioned that he fought at Marathon and not his achievements as a tragic playwright; perhaps Athens' greatest.

According to Herodotus, a man named Epizelus suddenly lost his sight as a gigantic armed warrior with a long beard passed him by and slew Epizelus' comrade.
Epizelus, the son of Cuphagoras, an Athenian, was in the thick of the fray, and behaving himself as a brave man should, when suddenly he was stricken with blindness, without blow of sword or dart; and this blindness continued thenceforth during the whole of his after life. The following is the account which he himself, as I have heard, gave of the matter: he said that a gigantic warrior, with a huge beard, which shaded all his shield, stood over against him; but the ghostly semblance passed him by, and slew the man at his side. Such, as I understand, was the tale which Epizelus told. (Herodotus 6.117)
The warrior described by Epizelus to the modern reader may appear to be a ghost or deity of some kind. However, the meaning of the story to an ancient Greek would have been clear. Blindness was a known punishment for looking directly at a god.
Who was the god that Epizelus saw? Herodotus does not say but the question may be answered by another story related by Pausanias a few centuries later that seems to be the natural evolution of Epizelus'.

If you visited Athens in the 2nd century BC and went to the Stoa Poikile you would have seen gigantic painting of the Battle of Marathon, the same one described by Pausanias in Pausanias 1.15.3.
In his description of the painting, Pausanias mentions a hero named Echetlaeus (He of the Plough-tail).
A little later in a chapter about Marathon, Pausanias says:
They say too that there chanced to be present in the battle a man of rustic appearance and dress. Having slaughtered many of the foreigners with a plough he was seen no more after the engagement. When the Athenians made enquiries at the oracle the god merely ordered them to honor Echetlaeus (He of the Plough-tail) as a hero. A trophy too of white marble has been erected. Although the Athenians assert that they buried the Persians, because in every case the divine law applies that a corpse should be laid under the earth, yet I could find no grave. There was neither mound nor other trace to be seen, as the dead were carried to a trench and thrown in anyhow. (Pausanias 1.32.5)
It is very likely that the myth of Echetaeus is connected to the bearded man seen by Epizelus; a story that had evolved with the passage of time into a more coherent and meaningful narrative.

Before the battle, the Athenians sent a messenger named Pheidippides to request Sparta's help. On his way to Sparta, the messenger encountered god Pan himself. The god addressed him by his name and, according to his testimony, asked why the Athenians were neglecting him when he had offered his help in the past and would also help in the future.
Truly, during the battle of Marathon, the Persians panicked and routed. Since for the ancient Greeks, Pan was behind each case of panic (which is literally where the word comes from), it made sense that they believed that Pan was on their side on the fields of Marathon.
Right after the battle Pan was honored with a temple under the Acropolis, yearly sacrifices, and a torch race. Another cave temple was established near the battlefield.

The battle of Marathon took place during the full moon, while the Athenians took the Persians by surprise with an early swift attack when the moon would still be visible.
As such, Artemis, a goddess identified with the moon, was considered present during the battle.

According to a story repeated by multiple ancient authors, including Aelian (Varia Historia 2.25), Xenophon (Anabasis 3.2.11), and Plutarch in his scathing critique of Herodotus (On the Malice of Herodotus 862), the Athenians had promised to sacrifice to Artemis as many goats as dead Persians. However, the battle exceeding the Athenians' expectations yielded a higher number of dead enemies (6400 according to Herodotus), so the Athenians decided to sacrifice 500 goats each year.

Heracles was also thought to be present due to the proximity of his temple and also because he was particularly loved in Marathon, where according to the ancient tales, he was first worshipped as a deity.

Theseus, the mythical founder of Athens, was also said to have fought at the battle of Marathon, according to the ancient legends. In the painting of the battle at the Agora, he was depicted as emerging from the underworld.
Theseus was a beloved hero in Athens and his myths were often used to forward Athenian propaganda.

Of course, the patron deity of Athens could not have missed the battle that would be remembered as the most important in the city's history.
Her great bronze statue on top of the Acropolis, the famous Athena Promachos, whose spear was visible from as far as the port of Peiraeus, was erected to commemorate Marathon, and was said to have been financed by the battle's spoils.
Divine Intervention and Signs
Herodotus' Marathon reeks of divine intervention. The Greek historian weaves together a story of divine signs and mysterious events that pointed toward an Athenian victory. A prime example is when Hippias, son of the deceased Athenian tyrant Peisistratus, whom the Persians wished to reinstate upon taking Athens, coughed harder than usual and lost a... tooth (Herodotus 6.107).
Here's the story in Herodotus' words (be it in translation):
"Now, as he was a man advanced in years, and the greater number of his teeth were loose, it so happened that one of them was driven out with the force of the cough, and fell down into the sand. Hippias took all the pains he could to find it; but the tooth was nowhere to be seen: whereupon he fetched a deep sigh, and said to the bystanders:
"After all, the land is not ours; and we shall never be able to bring it under. All my share in it is the portion of which my tooth has possession."
So Hippias believed that in this way his dream was fulfilled."