Sayyiduna Abu al-Darda' (may Allah be pleased with him) narrated: Allah Almighty gave His Messenger some camels as fay' (spoils obtained without fighting), and he distributed them. Sayyiduna Abu Musa al-Ash'ari (may Allah be pleased with him) said: "O Messenger of Allah! Give me some too." The Prophet (peace and blessings be upon him) said: "No." He requested it of him three times, and The Prophet (peace and blessings be upon him) said: "By Allah, I will not do it." Then four fine camels remained, and The Prophet (peace and blessings be upon him) said: "O Abu Musa! Take them." He said: "O Messenger of Allah! Earlier I asked you for a gift and you refused me and swore an oath; now I fear that perhaps the Prophet (peace and blessings be upon him) has forgotten." The Prophet (peace and blessings be upon him) said: "When I swear an oath and then see something else as more virtuous, I give expiation for my oath and do what is more virtuous."
Imam al-Tabarani recorded it in al-Mu'jam al-Kabir, and its narrators are thiqat (trustworthy).