Turnout has been high in Tanzania's parliamentary and presidential elections, delayed from October after a vice-presidential candidate died.
The only reports of violence came from Zanzibar, where opposition protesters were hurt in clashes with police.
Counting has now begun, but officials say anyone queuing before the closure time will still be allowed to vote.
Campaigning ended on a dramatic note on Tuesday, when presidential frontrunner Jakaya Kikwete collapsed at a rally.
The ruling party candidate later blamed his collapse on exhaustion. He is expected to win the vote and become the next president.
Ten candidates are in the running to replace Benjamin Mkapa, who is standing down after serving the maximum two terms.
Eighteen political parties are contesting parliamentary seats, but the Chama Cha Mapinduzi (CCM) party - which has been in power for four decades - is expected to retain its majority there.
'Well but tired'
Long queues formed outside polling stations. Problems reported with names not appearing on registration lists, were not serious and primarily voters being impatient, an election commission official told the BBC.
Results are expected within three days.
Kikwete is expected to succeed President Mkapa
Earlier in the day, several opposition supporters in the semi-autonomous Zanzibar archipelago were injured in clashes with police.
The activists claim police opened fire on them as they attempted to prevent bogus voters from casting their ballot.
On Tuesday, Mr Kikwete, foreign minister in the current government, collapsed during a final speech at a CCM rally near Dar es Salaam.
The BBC's Noel Mwakugu said the politician fell from the podium. Mr Kikwete's wife began screaming and pandemonium broke out.
Amid the confusion, President Mkapa assured the crowd that Mr Kikwete was "well" but tired and wanted water.