French troops were brought in to protect the consulate building.
France, Gabon's former colonial ruler, has moved out many of its citizens from Port Gentil and advised thousands of other French residents across the country to stay in their homes.
Bernard Kouchner, France's foreign minister, denied his country had helped Ali Bongo win the vote and said Paris would accept the final results despite the opposition protests.
"There was barely any delay in the preparation and the carrying out of the election. It was all done transparently. France did not intervene," Kouchner told French radio.
Bongo, whose father Omar Bongo died in June, won 41.73 per cent of the vote, according to interior ministry figures.
Andre Mba Obame, an ex-interior minister, and Pierre Mamboundou, another election rival, both won about 25 per cent of the vote, the interior ministry said.
But all three had declared victory before the results were announced.
Moved to a secret location following the violence, Obame was reported by the AFP news agency as saying: "This is an electoral coup d'etat. I do not recognise the election results. It's me who won."
Observers and financial markets have played down the risk of major instability in the tiny African country, but said that some unrest was expected given the dispute over the result.