Madagascar is hoping for a second peaceful election since upheaval in 2009, when Ravalomanana was forced out of office by protests led by Rajoelina in what the African Union and other international organisations said was a coup.
Voting began early on Wednesday. Provisional results were expected before the end of the year.
"I hope that the next president of the republic will bring the development for the country, bring security and allow the children's education," said 21-year old student Haja Hasina after voting.
Rajoelina cast his ballot in the capital, Antananarivo, and said he would accept the result.
"Even if it is a rainy season, the sun is shining today. I hope the sun shall shine on Madagascar," Rajoelina said after voting.
"In case of vote rigging, it won't be from our side, I am a democrat and if I lose I will accept the decision."
Soldiers were deployed across the island to ensure security during the polls, said the minister of defence.
"Nearly 20,000 elements of the defence and security forces are deployed throughout the country, 900 in the capital to ensure the security of the election," said the minister, General. Beni Xavier Rasolofonirina.
"I call on the Malagasy to defend their choice, not to let the two candidates and their supporters do the job, come and vote and then assist and monitor the counting of votes."
The former president, Hery Rajaonarimampianina, had been hoping for a second term in the November vote but came a distant third and was eliminated.
(With inputs from agencies.)