Libya's first free elections in decades, following the ouster of dictator Moamer Kadhafi, were hailed by the West as a democratic milestone, despite protests disrupting some polling in the restive east.
Turnout was put at 60 percent by the country's Electoral Commission, according to preliminary figures.
Gunmen killed one person and wounded two others near a polling station in the eastern city of Ajdabiya, an official told AFP, a day after an election worker died when a helicopter carrying election materials was also targeted.
In the capital, long queues formed of people keen to elect the General National Congress, which will steer Libya through a transition period.
"Words cannot capture my joy, this is a historic day," said Fawziya Omran, 40, voting in a school in the heart of Tripoli.
US President Barack Obama led the upbeat reaction from the West, calling the elections "another milestone" in Libya's transition to democracy.
"After more than 40 years in which Libya was in the grip of a dictator, (the) historic election underscores that the future of Libya is in the hands of the Libyan people," the US president added in a written statement.
EU foreign policy chief Catherine Ashton called the elections "truly historic" and the polling "dignified and orderly."
British Foreign Secretary William Hague also spoke of a "Landmark moment," stressing that the reported security incidents "appear isolated."
Some voters sported black, red and green flags -- the colours of the revolution that toppled Kadhafi last year.
Joy was also palpable in the eastern city of Benghazi, cradle of the revolt.
"I feel like my life has been wasted so far, but now my children will have a better life," said Hueida Abdul Sheikh, a 47-year-old mother of three.
Interim leader Mustafa Abdel Jalil was jubilant as he voted in his hometown of Al-Bayda, also in the east.
Protesters demanding greater representation in the 200-member congress disrupted voting elsewhere in the region, however.
Electoral commission chief Nuri al-Abar said that "despite a day of crisis management" only 24 out of 1,554 polling stations had not been able to open their doors due to acts of sabotage mostly in the east.
Preliminary results are due on Monday or Tuesday, the electoral commission said.
Signup to our newsletter and follow us on Facebook and Twitter!
In Benghazi after the official end of polling the streets filled with joyous crowds and cars with blaring horns, as people fired celebratory gunshots into the air and let off fireworks, waved flags and flashed "V for victory" signs.
There were similar scenes in the capital.
Protesters unhappy over the east's share of seats in the new assembly had earlier targeted polling centres and also forced oil facilities to shut down ahead of the election.
Alexander Graf Lambsdorff, who heads a team of 21 European Union observers, said large numbers had come out to vote "peacefully and free of fear and intimidation, despite some disturbances in the east and some tensions in the south," he told AFP.
"The election, however, is far from over," he cautioned. "Counting, tallying and the publication of results are the other important steps in this electoral process."
The make-up of the congress being elected has been a matter of heated debate, with factions such as the federalist movement calling for more seats.
The outgoing National Transitional Council (NTC) says seats were distributed according to demographics, with 100 going to the west, 60 to the east and 40 to the south.
But factions in the east, which was marginalised under Kadhafi, want an equal split and had threatened to sabotage the vote if their demand was not met.
The authorities dismiss such groups as a minority.
Libya has not seen national elections since the era of the late king Idris, whom Kadhafi deposed in a bloodless coup in 1969.
Political parties were banned as an act of treason during Kadhafi's iron-fisted rule. Now there are 142 parties fielding candidates.
A total of 80 seats are reserved for party candidates while 120 seats are open to individual candidates. Altogether, 3,707 candidates are standing in 72 districts nationwide.
From the parties, the coalition of ex-revolution prime minister Mahmud Jibril is seen as a key contender among liberals, facing stiff competition from two Islamist parties -- Justice and Development and Al-Wattan.
The winds of the Arab Spring that ushered Islamists into power in neighbouring Tunisia and Egypt may well bring about the same result in Libya.
The incoming congress will have legislative powers and appoint an interim government. But a last-minute NTC decree stripped its right to appoint a constituent assembly, which will be chosen in a separate election instead.
The uprising that began in Benghazi in February 2011 ended more than four decades of rule under Kadhafi who was captured and killed in October in his final bastion and hometown of Sirte.