Hadithcore
Sahih al-Bukhari, 1326
sahih

Narrated 'Amir:

Ibn `Abbas (who was at that time a boy) said, "Allah's Messenger (ﷺ) came to a grave and the people said, 'He or she was buried yesterday.' " Ibn `Abbas added, "We aligned behind the Prophet (ﷺ) and he led the funeral prayer of the deceased."

حَدَّثَنَا يَعْقُوبُ بْنُ إِبْرَاهِيمَ، حَدَّثَنَا يَحْيَى بْنُ أَبِي بُكَيْرٍ، حَدَّثَنَا زَائِدَةُ، حَدَّثَنَا أَبُو إِسْحَاقَ الشَّيْبَانِيُّ، عَنْ عَامِرٍ، عَنِ ابْنِ عَبَّاسٍ ـ رضى الله عنهما ـ قَالَ أَتَى رَسُولُ اللَّهِ صلى الله عليه وسلم قَبْرًا، فَقَالُوا هَذَا دُفِنَ، أَوْ دُفِنَتِ الْبَارِحَةَ‏.‏ قَالَ ابْنُ عَبَّاسٍ ـ رضى الله عنهما ـ فَصَفَّنَا خَلْفَهُ ثُمَّ صَلَّى عَلَيْهَا‏.‏

References2 variants
In-Book Reference
Book 23, Hadith 82
USC-MSA web (English) reference
Vol. 2, Book 23, Hadith 411 (deprecated numbering scheme)