Their departure came despite a N Korean tit-for-tat ban with Malaysia after Kim Jong-nam’s murder.
Two UN workers who were among 11 Malaysians banned from leaving North Korea have flown out of the country, the UN says.
The pair, who are employed by the World Food Programme (WFP), arrived in Beijing on Thursday.
North Korea and Malaysia on Tuesday banned each other’s citizens from leaving, in a row over the killing of the North Korean leader’s half-brother.
Kim Jong-nam was killed with a potent nerve agent at Kuala Lumpur airport.
Malaysia has not directly blamed North Korea for this, but there is widespread suspicion Pyongyang was responsible.
Investigators have demanded North Korea hand over suspects, three of whom are thought to be hiding in North Korea’s embassy in Malaysia.
North Korea has fiercely denied culpability and the row over the killing – and who has the right to claim Mr Kim’s body – has rapidly escalated over the past two weeks.
In a brief statement, WFP confirmed its employees were now in China.
„The staff members are international civil servants and not representatives of their national government,“ it said.
A government official told AFP news agency Malaysia did not play a role in securing the release of the pair, who hold UN travel documents.
Their departure leaves nine Malaysian nationals in North Korea. The Malaysian authorities say there are about 1,000 North Koreans currently in Malaysia.
Malaysian Prime Minister Najib Razak wrote on Facebook that he had spoken to Encik Mohd Nor Azrin, counsellor at the Malaysian Embassy in North Korea.
„I have given him my assurance that the government will do everything we can to ensure that they return home safely soon,“ he wrote.
„Even though they are refrained from leaving the country, the North Korean government have assured us of their safety and they are free to go about their daily lives. “
North Korea enacted its travel ban first, saying Malaysians could not leave until „the incident that happened in Malaysia is properly solved“.
Malaysia described Pyongyang’s move as an „abhorrent act“ and put in place a reciprocal ban. Immigration officials in Sarawak, Malaysia have since detained dozens of North Koreans, saying their work permits have expired.
But Mr Razak said on Thursday that diplomatic ties between the two sides would not be cut. „We need to continue communicating with them to find a solution,“ he said.
On Wednesday he said officials were still trying to get DNA samples from Mr Kim’s immediate family to formally identify his body, saying maybe they were „scared to come forward“.
A video emerged on Wednesday of Kim Han-sol, the son of Kim Jong-nam. Officials at South Korea’s Unification Ministry and National Intelligence Service confirmed his identity.
In the short clip, he said he was with his mother and sister but did not say where. It was his first appearance since the death of his father.
„We hope this gets better soon,“ he said.