The nearly 2,000-kilometre-long oil pipeline will allow Niger – one of the world's poorest countries – to sell its crude on the international market for the first time, via the Benin port of Seme.
A commissioning ceremony was held at the Agadem oil site, more than 1,700 kilometres (around 1,500 miles) from the capital Niamey, in the desert region of Diffa.
Prime Minister Ali Mahaman Lamine Zeine said the resources from exploitation would be used to "ensure the sovereignty and development of our country".
The border between Niger and Benin is closed following heavy sanctions imposed by the Economic Community of West African States (ECOWAS) after the July 26 military takeover.
Energy ministers from Mali and Burkina Faso – who have showed support to Niger's new leaders and have both undergone military coups in the past two years – were present at the ceremony.
The pipeline project was supposed to be completed in 2022 but was delayed by the Covid-19 pandemic, the project owner told AFP.
The oil is extracted by the China National Petroleum Corporation.
Some $6 billion has been invested in the project, according to Niger's government, including $4 billion to develop the oil fields and $2.3 billion for the construction of the pipeline.
It says this investment has allowed the country to increase oil production to 110,000 barrels per day, with an official target to increase to 200,000 barrels per day by 2026.
Niger, where the military seized power on July 26 by overthrowing elected president Mohamed Bazoum, had seen mass protests calling for troops of former colonial ruler France to leave.
As well as the ECOWAS sanctions, many Western countries have cut off development aid to Niger.
The World Bank has warned that GDP growth is set to fall to 2.3 percent this year if international sanctions continue.