Sahih Muslim, Book 27, Hadith 23 (Muslim 4237)

'Adi b. Hatim reported Allah's Messenger (ﷺ) as saying:

He who took an oath, but he found something else better than that, should do that which is better and break his oath.