Cohen, 13, was deep into his Torah reading Thursday when he heard shouting and saw girls pushing against the barrier separating men from women at the holy site to catch a glimpse of the Hollywood superstar.
"At first I didn't know who it was," Cohen said. Smith compensated for the interruption by shaking the bar mitzvah boy's hand and posing for a picture with him.
Surrounded by a security detail, Smith approached the wall and put a note in the cracks in keeping with tradition.
Smith and his wife, Jada Pinkett Smith, then took a tour of an excavated tunnel alongside the wall. The tour leader was Shmuel Rabinovitch, chief rabbi of the holy site, who said the couple took notes and spent several minutes praying.
"He is a very nice man, he was very excited and showed his emotions," he said.
Smith and his wife later visited the nearby Church of the Holy Sepulcher, built on the site where many Christians believe that Jesus was crucified.