We were discussing some matter, and since I was new to Islam and had only recently left the days of ignorance, I swore by al-Lat and al-Uzza. The companions of the Messenger of Allah ﷺ said to me, "What a terrible thing you have said. Go to the Messenger of Allah ﷺ and tell him, for we can only see that you have committed disbelief."So I went to him and told him what had happened. He said to me, "Say, 'There is no god but Allah alone, He has no partner,' three times, and seek refuge with Allah from Satan three times, and spit lightly to your left three times, then never do it again."
أخبرنا أبو داود قال حدثنا الحسن بن محمد قال حدثنا زهير قال حدثنا أبو إسحق
كنا نذكر بعض الأمر وأنا حديث عهد بالجاهلية فحلفت باللات والعزى فقال لي أصحاب رسول الله ﷺ بئس ما قلت ائت رسول الله ﷺ فأخبره فإنا لا نراك إلا قد كفرت فأتيته فأخبرته فقال لي قل لا إله إلا الله وحده لا شريك له ثلاث مرات وتعوذ بالله من الشيطان ثلاث مرات واتفل عن يسارك ثلاث مرات ولا تعد له
Sourcing, [sahih] Ibn Majah narrated it in Kaffarat, chapter on the prohibition of swearing by other than Allah, no. 2097, from the hadith of Abu Ishaq Sabi in this form, and it is also in al-Kubra, no. 4717. See also the hadith that follows.