It only took a few minutes for the announcement to sink in before several of Libreville's poorer neighbourhoods erupted in anger, with thousands of people taking to the streets to express their fury.
According to official results made public shortly after 1500 GMT, Bongo won Saturday's presidential poll by just 5,594 votes, taking 49.80 per cent to 48.23 per cent for his rival Jean Ping, a veteran diplomat and former top African Union official.
By nightfall, protesters vented their fury by setting fire to the parliament building, sending skyward a plume of flame and black smoke, witnesses and AFP correspondents said.
Fires were visible in other parts of Libreville and explosions were heard as protesters faced off against heavily armed security forces.
More From This Section
"The whole building is catching fire," a man outside parliament who gave name as Yannick told AFP.
The parliament lies on the same road as the state TV headquarters, senate, town hall, oil ministry, several embassies and the French cultural centre.
As helicopters flew overhead and smoke rose above poorer neighbourhoods, soldiers, police and gendarmes stopped traffic on the main highway where protestors braved tear gas to set tyres alight.
Protestors shouted, "Jean Ping president!" and "They stole the election."
Ping, a half Chinese career diplomat has rejected the results, and before they were announced had declared it was he who won.
There was also trouble today in the economic capital Port Gentil, which saw the worst of the violence that followed Bongo's 2009 election victory.
Any appeal by Ping would likely focus on disputed results in one of the country's nine provinces - the Haut-Ogooue, the heartland of Bongo's Teke ethnic group.