Magarief, seen as a moderate Islamist, won by 113 votes, beating liberal candidate Ali Zidane, who received 85 votes, BBC Online reported.
Effectively the acting head of state, Magarief now heads the 200-member congress, which will name a prime minister, pass laws and steer Libya to full parliamentary elections after a new constitution is drafted next year.
Magarief was born in Benghazi, the cradle of last year's revolt that ousted Muammar Gaddafi. With a degree in economy and a doctorate in finance obtained in the UK, Magarief resigned as Libyan ambassador to India and went into self-exile in the 1980s. He is a leading figure in the country's oldest opposition movement, the National Front for the Salvation of Libya, which united the opposition in exile. The leader of the National Front party, he won a seat for his party in the July 7 poll, Libya's first free election in a generation.
The assembly also voted for Giuma Attaiga, a lawyer from the port city of Misrata, another symbol of the anti-Gaddafi uprising, as a deputy to Magarief. Attaiga beat out Salah al-Makhzoum, of the Justice and Construction party, which is the political wing of the Muslim Brotherhood, in second-round voting.
In a ceremony that was the first peaceful transition of power in Libya's modern history, the new assembly began life on Wednesday when it took power from the National Transitional Council, the political arm of the opposition forces that toppled Gaddafi a year ago.
A majority of seats are held by a formation called the Alliance of National Forces. A liberal coalition of small moderate parties led by former National Transitional Council Premier Mahmoud Jibril holds 39 seats, while the Justice and Construction Party won 17. The remaining seats are in the hands of a galaxy of smaller parties. (ANSAMed).