HARARE, Zimbabwe — Millions of Zimbabweans cast ballots on Monday in a general election that many hoped would earn the endorsement of Western governments and win economic assistance needed to repair decades of misrule under Robert Mugabe.

Long lines of enthusiastic voters formed at polling stations on the outskirts of Harare, the capital, before voting began at 7 a.m., following a peaceful campaign without the widespread violence, intimidation and fraud of previous elections. Election observers from Europe and the United States, long barred by Mr. Mugabe, joined local organizations in monitoring the vote.

“The election is O.K., it’s taking place peacefully so far,” said Nyasha Simbo, who had just voted in Westlea, a middle-class neighborhood where the opposition has long had support. In the past two elections, Ms. Simbo added, she had sheltered friends fleeing violence at the hands of the ruling ZANU-PF party and the police.

The race for the top position — pitting President Emmerson Mnangagwa against the main opposition leader, Nelson Chamisa — was considered too close to call. Both candidates campaigned on pledges to improve the economy, create jobs and attract foreign investment.