Wearing a black skullcap, he paused in front of the holiest site where Jews can pray, then placed what appeared to be a written prayer or note between its stones, as is custom.
Trump was not accompanied by any Israeli leaders during the hugely symbolic visit.
Allowing them to do so could have led to accusations that Washington was implicitly recognising Israel’s unilateral claim of sovereignty over the site, which would break with years of US and international precedent.
Security was tight, with the usually bustling Old City, where the Western Wall is located, essentially on lockdown and the plaza leading to the site cleared.
As Trump’s convoy of dozens of cars entered the square around 4:00 pm (1300 GMT), armed security forces were positioned on nearly every building nearby as well as on the outer wall of the Old City.
In the nearby Jewish Quarter, barriers had been erected to make viewing the square impossible from ground level, and some residents said they had been told not to go onto their roofs overlooking the Western Wall.
Simon, a 20-year-old American studying in a nearby Jewish seminary, said he was “excited” by Trump’s visit but disappointed he would not see him.
Around a dozen ultra-Orthodox Jewish men had crammed into a tiny terrace on top of one house looking over, seemingly having been granted permission.
Related reading’A great honor – peace’
Trump was accompanied by the Western Wall’s rabbi, Shmuel Rabinovitz, during his visit.
Trump’s daughter Ivanka, who converted to Judaism and is married to one of the president’s top aides Jared Kushner, visited the women’s side of the wall.
Trump, who is Protestant, is the first US president to have Jewish members of his immediate family.
Under strict interpretation of Jewish law, men and women must pray separately at the wall. The rule has been repeatedly challenged by progressive Jewish movements seeking equal prayer rights.
Trump wrote “This was a great honor — peace!” before signing his name in the wall’s guest book.
Rabinovitz presented him with a gold-leafed Book of Psalms stamped with the president’s name, according to pictures released by the holy site’s administration.
Speaking later in the day, Trump said he had been “deeply moved” by the visit.
“Words fail to capture the experience,” he said ahead of dinner at Prime Minister Benjamin Netanyahu’s residence.
“It will leave an impression on me for ever.”
The Western Wall is the last remnant of the supporting wall of the second Jewish temple, built by King Herod and destroyed by the Romans in 70 AD.
It is situated below the Al-Aqsa mosque compound, Islam’s third-holiest site, referred to by Jews as the Temple Mount and considered their holiest.
The visit to the Western Wall drew controversy before Trump even left Washington, when US officials declined to say whether it belonged to Israel.
The status of Jerusalem is ultra-sensitive and has been among the most difficult issues in Israeli-Palestinian peace talks.
Mexicans turned away
Israel occupied east Jerusalem, where the Western Wall is located, and the West Bank in 1967 in moves never recognised by the international community.
It later annexed east Jerusalem and claims the entire city as its capital. The Palestinians see east Jerusalem as the capital of their future state.
The traditional American position has been that Jerusalem’s status must be negotiated between the two sides.
Trump visited the wall as part of his first trip abroad as president, which includes stops at important sites for Christians, Muslims and Jews.
On Saturday and Sunday he was in Saudi Arabia, and later stops will include the Vatican.
Before visiting the Western Wall, Trump toured the nearby Church of the Holy Sepulchre, built at the site where Christians believe Jesus was crucified, buried and resurrected.
A group of six Christian Mexicans hoping to see the church discussed ways to get out of the Old City with Israeli police, after being told they could not visit.
Group member Mauricio Guerra said he was “very disappointed” not to be able to visit the site as he had only one day in Jerusalem.
“We have travelled here to see the church,” he told AFP.
“We as Mexicans have Trump as our neighbour and now he is following us here as well,” he laughed, with Trump having pledged to build a wall between the United States and Mexico during his campaign.
“He is our cross (to bear)” he said, holding his arms wide to imitate a crucifixion.
“You can do what you like with a wall on the border, but don’t ask us to pay for it!” Guerra added of Trump’s many claims that Mexico would foot the bill.