Khalid al-Mishri, a leading figure in the Justice and Construction Party of the Muslim Brotherhood in Libya, won the position of the head of the High Council of State (HCS), replacing Abdulrahman al-Swehli.
Mishri won 64 votes - while 45 went for Swehli, who is the founder of HCS and its head for two consecutive years - in the second round of elections that took place in Tripoli on Saturday.
Mohamed Maazeb and Abdulla Juwan were the two other candidates competing for the post.
Swehli was tipped to be re-elected after winning the first round by 37 votes while Mishri came second with 36, Juwan 26 and Maazeb with 17 votes out of 122.
Naji Mukhtar was also elected as first deputy president of the HCS while Fawzi Aqab was elected as second deputy.
Mishri, 51, is considered one of the most prominent opponents of head of the Libyan National Army (LNA) Khalifa Haftar and of the Karama Operation, which has been launched against extremist groups in the country, especially in the eastern region.
He was a member of the outgoing General National Congress (parliament), the chairman of its finance committee and a member of the national security committee.
The elections were held at a time of a state of shock in Libya following the discovery of the remains of three young children of the same family who were kidnapped in 2015 while heading to school near the capital.
The children, who came from the family of al-Shershari, a Libyan businessman, were found killed in Abu Issa area between Sorman and al-Zawiya in western Libya after they were abducted for ransom in December 2015.
The kidnappers had demanded 20 million Libyan dinars from the father of the three children for their release.
The remains of the children, who were seven, nine, and 13-years-old when they were kidnapped, were found buried in a forest south of the city of Sorman and taken to the city's hospital.