Abdullah bin Umar reported,

The people of the pre-Islamic era used to fast on the day of Ashura, and the Messenger of Allah ﷺ and the Muslims fasted on it before the fast of Ramadan was made obligatory. When Ramadan was made obligatory, the Messenger of Allah ﷺ said, "Ashura is one of the days of Allah, so whoever wishes may fast it, and whoever wishes may leave it."

Azami 4481

Sahih

عن عبد الله بن عمر

أن أهل الجاهلية كانوا يصومون يوم عاشوراء، وأن رسول الله ﷺ صامه والمسلمون، قبل أن يفترض رمضان، فلما افترض رمضان، قال رسول الله ﷺ: إن عاشوراء يوم من أيام الله، فمن شاء صامه ومن شاء تركه.

الأعظمي 4481صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Fasting
Chapter
Voluntary fasting and encouragement to do it
Section
Clarification on the abrogation of the obligation to fast on Ashura after the obligation of fasting in the month of Ramadan
Numbering
Jami al-Kamil 4481 (2nd edition)
Azami 4481