It is narrated from Sayyiduna Ali bin Abi Talib (may Allah be pleased with him) that he said: "On the day of Badr I fought hard, then I came to the Prophet (peace and blessings be upon him) and found him (peace and blessings be upon him) in prostration, saying: 'O Ever-Living, O Sustainer of all!' Then I went (back) and fought, then when I came back, the Prophet (peace and blessings be upon him) was (still) in prostration, saying: 'O Ever-Living, O Sustainer of all!'" He said: "Then Allah Almighty granted him (peace and blessings be upon him) victory."
The wording of all these teachers is the same, except that in the narration of Ibn Hamdan (may Allah have mercy on him) the word "qitalan" (hard fighting) is not mentioned.
Imam al-Nasa'i (may Allah have mercy on him) narrated this hadith in 'Amal al-Yawm wa al-Laylah, through Muhammad bin Bashshar (may Allah have mercy on him).