The Prophet ﷺ reached Mecca, circumambulated the Kaʿba seven times and then offered a two rakʿat prayer behind Maqam Ibrahim. Then he went towards the Safa. Allah has said, "Verily, in Allah's Apostle you have a good example."
سَمِعْتُ ابْنَ عُمَرَ ؓ يَقُولُ قَدِمَ النَّبِيُّ ﷺ فَطَافَ بِالْبَيْتِ سَبْعًا وَصَلَّى خَلْفَ الْمَقَامِ رَكْعَتَيْنِ ثُمَّ خَرَجَ إِلَى الصَّفَا وَقَدْ قَالَ اللَّهُ تَعَالَى {لَقَدْ كَانَ لَكُمْ فِي رَسُولِ اللَّهِ أُسْوَةٌ حَسَنَةٌ}