It was the first such meeting since the two countries normalised relations 20 years ago.
Mr Obama said that despite differing political philosophies, the two countries were deepening co-operation.
Analysts say the US and Vietnam are seeking stronger ties in the face of an increasingly assertive China.
This month marks 40 years since the end of the Vietnam war.
"Obviously, there has been a difficult history between our two countries in the 20th Century and there continues to be significant differences in political philosophy and political systems," Mr Obama said.
"What we have seen is the emergence of a constructive relationship that is based on mutual respect and that has benefited the people of both countries."
Mr Trong described the talks as "cordial, constructive, positive and frank".
"What is of utmost importance is that we have been transformed from former enemies to become friends [and] comprehensive partners," he said.
"I am convinced our relationship will continue to grow in the future."
He said he had invited Mr Obama to visit Vietnam and the president had accepted.
Also on the agenda were talks on trade. President Obama is seeking to create a 12-nation free trade plan known as the Trans-Pacific Partnership that would include Vietnam.
However, Tuesday's meeting was not welcomed by everyone.
Outside the White House, demonstrators protested against human rights violations in Vietnam, while a group of US lawmakers wrote an open letter to Mr Obama complaining about the invitation.
China has angered some of its Asian neighbours, including Vietnam, by taking a more assertive stance on territorial claims in the South China Sea.
It has deployed military equipment to the disputed Spratly Islands, claimed in part by Vietnam.
The Spratlys may have reserves of oil and gas around them and the surrounding sea is also a major shipping route and home to important fishing grounds.
US President Barack Obama has held historic talks at the White House with Vietnam's Communist Party leader, Nguyen Phu Trong.