Perhaps Agincourt? Roman soldiers would have their pilum so perhaps one of their battles although since the legionaire was a close combat soldier I won't consider them in this question.
The main method of warfighting today is with ranged weapons but in ancient history most troops would fight with close combat weapons, which battle signalled the historical transition?
I can't claim to be an expert on prehistoric warfare, but I would guess that the earliest battle won by missile weapons is the earliest battle ever fought. This sort of combat is appropriate for peoples at a relatively low level of military organisation and technology. Bows, atl-atls, slings, throwing spears and rocks allow a warrior to remain at a safe distance from the enemy. Even in the Iliad, the earliest work of Greek literature, the great majority of the killing is done by throwing spears.
However, all these early engagements are lost to time. I imagine your actual question is what is the earliest recorded battle in which missile troops played a decisive tactical role. Unless some Egyptian or Assyrian chronicle provides an earlier example, I think the answer to that question is the battle of Spartolos in 429 BC. Thucydides (2.79.1-6) describes it as follows:
The Athenians marched with two thousand hoplites and two hundred horse against the Chalkidians in the direction of Thrace and the Bottiaians, just as the corn was getting ripe, under the command of Xenophon, son of Euripides, with two other generals. Arriving before Spartolos in Bottiaia, they destroyed the corn and had some hopes of the city coming over through the intrigues of a faction within.
But those of a different way of thinking had sent to Olynthos; and a garrison of hoplites and other troops arrived accordingly. When these sallied from Spartolos, they were engaged by the Athenians in front of the town.
The Chalkidian hoplites, and some auxiliaries with them, were beaten and retreated into Spartolos; but the Chalkidian horse and light troops defeated the horse and light troops of the Athenians. The Chalkidians had already a few peltasts from Krousis, and right after the battle were joined by some others from Olynthos; when they saw these, the light troops from Spartolos, emboldened by this arrival and by their previous success, with the help of the Chalkidian horse and the reinforcement that had just arrived, again attacked the Athenians, who retired upon the two units which they had left with their baggage.
Whenever the Athenians advanced, their enemy gave way, pressing them with missiles the instant they began to retire. The Chalkidian horse also, riding up and charging them just as they pleased, at last caused a panic amongst them and routed and pursued them to a great distance.
This was not, of course, a "historical transition"; since light troops could not stand up to hoplites in close combat and were vulnerable to cavalry attacks, melee infantry was not eclipsed. The battle simply provides evidence that even in Classical Greece the prevalent tactical system was one of combined arms rather than overreliance on any single type of warrior. There are plenty of other examples from that period where a hoplite force stripped of its more flexible support units becomes easy prey for missile troops. There was nothing the heavily armed hoplites could do about the incessant attacks of light infantry.
I don't know if this question can be answered as phrased, the first battle in which ranged weapons were key to victory was probably in prehistoric times. Do you mean major battle? Or first case in Europe or middle ages? The bow is over ten millennia old, you're going to have to be a bit more specific.
In any case, it's definitely not Agincourt. Even in the same war the major Battles of Crecy and Poitiers preceded Agincourt, and the English only brought archers to France because of successes they had with them in Britain. And centuries before any of this happened, millions of people around the world were using the bow and arrow as their primary weapon like the Mongols.