Nguyen Phu Trong.

Vietnam's National Assembly has elected Nguyen Phu Trong, the ruling communist party's general secretary, as the country's new president.

The 74-year-old took his oath of office late Tuesday for the largely ceremonial role, swearing loyalty to the nation, people and the national constitution.

In a 476-1 vote, lawmakers in the National Assembly - the rubber-stamp legislature for the Communist Party of Vietnam - elected Trong to the presidency.

Trong has been party chief and thereby de-facto head of government since 2011. He is now the first person since Ho Chi Minh to be both party chief and president.

In a unanimous vote on October 3, the communist party's Central Committee elected him president of the country.

Vietnam, a single-party state, has no legal opposition party.

Under Trong's leadership, the party has embraced free trade agreements, including the defunct Trans-Pacific Partnership, and the party leader is considered cautiously open to greater economic reforms.

Trong has also overseen a two-year corruption crackdown that meted out a 31-year prison sentence to former Ho Chi Minh City party boss and politburo member Dinh La Thang on charges related to his time as chairman of the state oil company.

Le Dang Doanh, a party member who formerly served as a senior economic adviser to the government, described Trong as a pragmatist in global affairs who is friendly with China and the US - both former wartime foes of Vietnam.

"He has received many representatives of the US, and he has promoted the bilateral relation between Vietnam and the US," Doanh said.

Carl Thayer, emeritus professor at the University of New South Wales and an expert on Vietnam, said that one of the principle arguments for giving the party boss the presidency was to conform to international diplomatic protocol during bilateral meetings with foreign heads of state and government.

"By making the two posts concurrent, it is argued, Vietnam will be able to deal more decisively with pressing issues," he said.

Tuesday's special election followed the death of president Tran Dai Quang on September 21. Trong's presidential term is due to end in 2021.