Even before it occurred, the visit stirred debate, with critics accusing both sides of having selective memories, and pointing to paradoxes in policies relying on nuclear deterrence while calling for an end to atomic weapons.
The two governments hope Obama's visit to Hiroshima, where a U.S. atomic bomb killed thousands instantly on Aug. 6, 1945, and some 140,000 by the year's end, underscores a new level of reconciliation and tighter ties between the former enemies.
"We come to ponder the terrible force unleashed in the not so distant past," Obama said after laying a wreath at a Hiroshima peace memorial.
"We come to mourn the dead, including over 100,000 Japanese men, women and children, thousands of Koreans and a dozen Americans held prisoner. Their souls speak to us."
Before laying the wreath, Obama visited a museum where haunting displays include photographs of badly burned victims, the tattered and stained clothes they wore and statues depicting people with flesh melting from their limbs.
"We have known the agony of war," he wrote in the guest book. "Let us now find the courage, together, to spread peace, and pursue a world without nuclear weapons."
After speaking, Obama shook hands and chatted briefly with two atomic bomb survivors. Obama and Sunao Tsuboi, 91, smiled as they exchanged words; Shigeaki Mori, 79, cried and was embraced by the president.
The city of Nagasaki was hit by a second nuclear bomb on Aug. 9, 1945, and Japan surrendered six days later.
A majority of Americans see the bombings as having been necessary to end the war and save lives, although some historians question that view. Most Japanese believe they were unjustified.
The White House had debated whether the time was right for Obama to break a taboo on presidential visits to Hiroshima, especially in an election year.
But Obama's aides defused most negative reaction from military veterans' groups by insisting he would not second-guess the decision to drop the bombs.
Obama's main goal in Hiroshima was to showcase his nuclear disarmament agenda, for which he won the 2009 Nobel Peace Prize.
"Amongst those nations like my own that own nuclear stockpiles, we must have the courage to escape the logic of fear and pursue a world without them," he said.
Obama avoided any direct expression of remorse or apology for the bombings, a decision that some critics had worried would allow Japan to stick to the narrative that paints it as a victim.
"We remember all the innocent killed in the arc of that terrible war and wars that came before, and wars that would follow. We have a shared responsibility to look directly in the eye of history," he said.
For atomic bomb survivor Eiji Hattori, Obama's remarks provided solace.
"I think it was an apology," said Hattori, 73, who was a toddler at the time of the bombing and now suffers from three types of cancer.
"I didn't think he'd go that far and say so much. I feel I've been saved somewhat ... For me, it was more than enough."
Mori was also consoled by the president's embrace. "It made me so happy that I thought I was walking on air," he said.
Survivors said earlier an apology from Obama would be welcome but for many, the priority was ridding the world of nuclear arms, a goal that seems as elusive as ever.
Obama has invested heavily during his term in modernizing the U.S. nuclear arsenal, and Japan relies on the U.S. nuclear umbrella for extended deterrence.
"I'm afraid I did not hear anything concrete about how he plans to achieve the abolition of nuclear weapons," said Miki Tsukishita, 75.
"A-bomb survivors including me are getting older. Just cheering his visit is not enough."
Abe's government has affirmed past official apologies over the war but said future generations should not be burdened by the sins of their forebears.
China and South Korea, which suffered from Japan's wartime aggression, often complain it has not atoned sufficiently.
"It is worth focusing on Hiroshima, but it’s even more important that we should not forget Nanjing," Chinese Foreign Minister Wang Yi told reporters on Friday, according to the ministry's website.
China says Japanese troops in 1937 killed 300,000 people in its then-capital of Nanjing. A postwar Allied tribunal put the death toll at 142,000, but some conservative Japanese politicians and scholars deny a massacre took place at all.
"The victims deserve sympathy, but the perpetrators can never escape their responsibility," Wang said.